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

  • 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

  • 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.

Related