Is the peer functionality related to RTC?

Hello Nordic Engineer,

I used nRF52811

nRF5_SDK_17.1.0_ddde560 \ examples \ ble_central_and_peripheral \ experimental \ ble_app_multirole_lesc

After attempting to add NUS, NUS_C, and deleting PEER, and porting to 52811, I encountered an RTC error when running the final RTT.

The following image shows the modifications I made for porting to 52811

<sdk_config.h>
UART_LEGACY_SUPPORT     0
NRF_BLE_LESC_ENABLED    0
NRF_BLE_LESC_GENERATE_NEW_KEYS  0
NRF_CRYPTO_RNG_STATIC_MEMORY_BUFFERS_ENABLED    0
NRF_CRYPTO_RNG_AUTO_INIT_ENABLED    0
PM_LESC_ENABLED 0

<main.c>
delete --->  err_code = nrf_ble_lesc_request_handler()

Since I don't require the LESC functionality, I hope to have the same connection method as the peripheral UART example.

This is probably all the changes I made. How should I solve the RTC issue?

Thanks

Parents
  • Hello,

    The assert is likely unrelated to the RTC. You can try placing breakpoints in main() to determine where the assert was triggered. E.g., if the crash is occuring before or after ble_stack_init().

    Best regards,

    Vidar

  • Hello Berg,

    Thank you for your reply.

    I attempted debugging, not sure if it helped to resolve the issue?

    Normally, after executing line 1147 of code, line 1149 should be executed, but there's an issue.

    Currently, debugging is paused at line 1126 of the code because there is a yellow arrow to the left of the number 1126. When I continue running the program, it should proceed to line 229, but it doesn't. Instead, it enters 'NRF_BREAKPOINT_COND'.

    Another question: why can't I see the value of 'err_code' in 'watch1'?

    Thank you

  • sorry,

    I give up on the RTT repetitive printing issue. I only have one J-Link in hand, and I lack experience in firmware upgrades. I fear more problems might arise.

    May I ask a question?

    examples \ ble_central_and_peripheral \ experimental \ ble_app_multirole_lesc

    This is the example I've been using. I tried adding NUS and NUS_C, and deleted HRS and PEER. Finally, I ported it to 52811, all of which were successful. Eventually, I added UART functionality, successfully compiled it, and downloaded the program to 52811. However, after scanning with my phone, I couldn't find this device.

    Do you know how much RAM NUS and UART respectively occupy?

    Thank you

  • tony55723 said:
    Do you know how much RAM NUS and UART respectively occupy?

    I don't have any numbers on this. Generally, fitting a multirole application on the 52811 is challenging due to memory constraints. However, all memory is statically allocated, so you should receive an error at build time if there is insufficient memory. Have you checked the return code from your advertising start function?

  • The error I encountered is 'NRF_ERROR_INVALID_LENGTH'.

    I still feel very sorry, because of two things.

    【1】First, I asked about the error. Now I ask about the UART. I don’t know if this will violate the rules.

    【2】Yesterday I submitted a new question, and a few minutes ago the system prompted an engineer to accept it.

    what should i do now....?(What I mean is, will this cause you trouble?)

    Thank you

  • Is it your advertising start function that returns with NRF_ERROR_INVALID_LENGTH? 

    tony55723 said:
    First, I asked about the error. Now I ask about the UART. I don’t know if this will violate the rules.

    This is fine. Thank you for letting me know. The problem with duplicate questions is that we can end up with several engineers working on the same issue, which we want to avoid. However, the question you posted is not really a duplicate.

  • Thank you so mush.

    The 'NRF_ERROR_INVALID_LENGTH' issue has been resolved because it requires powers of 2, such as 2, 4, 8, 16, 32, 64.

    #define UART_TX_BUF_SIZE                32                                         /**< UART TX buffer size. */
    #define UART_RX_BUF_SIZE                32                                         /**< UART RX buffer size. */

    I'd like to ask a new question. I added NUS and NUS_C in ble_app_multirole_lesc and removed HRS. Both devices have downloaded the same program.

    The connection setup is as follows: Phone -> A -> B. At this point, the phone sends data to A. In the nus_data_handler of A, I receive data from the phone, and inside it, I execute ret_val = ble_nus_c_string_send(&m_ble_nus_c, ReceiveData, 20);. Unfortunately, B did not receive the data sent by A.

    static void nus_data_handler(ble_nus_evt_t * p_evt)	
    {
    	uint32_t ret_val;
    	uint8_t i;
    	
    	if (p_evt->type == BLE_NUS_EVT_RX_DATA)
        {
    		uint8_t ReceiveData[20];
    
    		
            NRF_LOG_DEBUG("Received data from BLE NUS. Writing data on UART.");
            NRF_LOG_HEXDUMP_DEBUG(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length);
    
            for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++)
            {
    			ReceiveData[i] = p_evt->params.rx_data.p_data[i];
            }
    			
    		NRF_LOG_INFO("data[0] = %d, data[1] = %d, data[2] = %d, data[19] = %d", ReceiveData[0], ReceiveData[1], ReceiveData[2], ReceiveData[19]);
    		
    		
    		do
    		{
    			ret_val = ble_nus_c_string_send(&m_ble_nus_c, ReceiveData, 20);
    			
    			if ( (ret_val != NRF_ERROR_INVALID_STATE) && (ret_val != NRF_ERROR_RESOURCES) )
    			{
    				APP_ERROR_CHECK(ret_val);
    			}
    		} while (ret_val == NRF_ERROR_RESOURCES);
    		
    		
    		for (i = 0 ; i < 20 ; i++)
    		{
    			if(i == 19)
    				app_uart_put(0xa0);
    			else
    				app_uart_put(ReceiveData[i]);
    		}
        }
    }

    Additionally, there is one more note: if Device B is connected to J-Link, RTT will provide feedback:

     <info> app: CENTRAL: Already connected to this device as PERIPHERAL (handle: 0), disconnecting.

    But if Device A is connected to J-Link, RTT will provide feedback:

    <info> app: PERIPHERAL: Already connected to this device as CENTRAL (handle: 1), disconnecting.

    I want to use NUS to send data. Does it conflict with the additional information?

    Thank you

Reply
  • Thank you so mush.

    The 'NRF_ERROR_INVALID_LENGTH' issue has been resolved because it requires powers of 2, such as 2, 4, 8, 16, 32, 64.

    #define UART_TX_BUF_SIZE                32                                         /**< UART TX buffer size. */
    #define UART_RX_BUF_SIZE                32                                         /**< UART RX buffer size. */

    I'd like to ask a new question. I added NUS and NUS_C in ble_app_multirole_lesc and removed HRS. Both devices have downloaded the same program.

    The connection setup is as follows: Phone -> A -> B. At this point, the phone sends data to A. In the nus_data_handler of A, I receive data from the phone, and inside it, I execute ret_val = ble_nus_c_string_send(&m_ble_nus_c, ReceiveData, 20);. Unfortunately, B did not receive the data sent by A.

    static void nus_data_handler(ble_nus_evt_t * p_evt)	
    {
    	uint32_t ret_val;
    	uint8_t i;
    	
    	if (p_evt->type == BLE_NUS_EVT_RX_DATA)
        {
    		uint8_t ReceiveData[20];
    
    		
            NRF_LOG_DEBUG("Received data from BLE NUS. Writing data on UART.");
            NRF_LOG_HEXDUMP_DEBUG(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length);
    
            for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++)
            {
    			ReceiveData[i] = p_evt->params.rx_data.p_data[i];
            }
    			
    		NRF_LOG_INFO("data[0] = %d, data[1] = %d, data[2] = %d, data[19] = %d", ReceiveData[0], ReceiveData[1], ReceiveData[2], ReceiveData[19]);
    		
    		
    		do
    		{
    			ret_val = ble_nus_c_string_send(&m_ble_nus_c, ReceiveData, 20);
    			
    			if ( (ret_val != NRF_ERROR_INVALID_STATE) && (ret_val != NRF_ERROR_RESOURCES) )
    			{
    				APP_ERROR_CHECK(ret_val);
    			}
    		} while (ret_val == NRF_ERROR_RESOURCES);
    		
    		
    		for (i = 0 ; i < 20 ; i++)
    		{
    			if(i == 19)
    				app_uart_put(0xa0);
    			else
    				app_uart_put(ReceiveData[i]);
    		}
        }
    }

    Additionally, there is one more note: if Device B is connected to J-Link, RTT will provide feedback:

     <info> app: CENTRAL: Already connected to this device as PERIPHERAL (handle: 0), disconnecting.

    But if Device A is connected to J-Link, RTT will provide feedback:

    <info> app: PERIPHERAL: Already connected to this device as CENTRAL (handle: 1), disconnecting.

    I want to use NUS to send data. Does it conflict with the additional information?

    Thank you

Children
Related