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

  • 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

  • What is the 'ret_val' value returned by ble_nus_c_string_send? The data will only be sent if it is NRF_SUCCESS ('0').

  • Finally, with this code added, I can send the data.

    ble_nus_c_on_db_disc_evt(&m_ble_nus_c, p_evt);

    Has Easter holiday ended?

    No one has answered any questions these days...

  • Excellent. Yes, most have now returned to the office.

  • Thank you very much. Your previous responses have taught me a lot. Now, all I need to do is fill in my custom data, and this product will be complete. If possible, I'll set it to 'Verify Answer'.

Reply Children
No Data
Related