This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Nordic DEvice Hangs randomly

In our Nordic application, we are sampling ADC data at 500Hz and sending the captured 5 sample data at 100Hz frequency to UART Mobile application over BLE.

Each sample is of 2 bytes so we are sending 10 bytes at a time.

However device gets hang at random.  It doesn’t give any error. The application is run in Debug configuration.

It recovers only after power recycle. When we debug no error messaged are logged.

We observed that if we don't send data to mobile application then device works properly.

 

The API which is used to send data is “ble_nus_data_send”

 

Can you give us the any pointers to Debug this issue.

Parents
  • The issue is resolved, We got the hint from the following link,

    https://devzone.nordicsemi.com/f/nordic-q-a/35647/send-packets-continuously-in-ble_app_uart-example

     

    The issue was we were getting the return value of NRF_ERROR_RESOURCES from the API ble_nus_data_send.

    This means that Stack is busy processing previous packet and in this case we need to wait till get the response with  the event BLE_EVT_TX_COMPLETE 

     

    We were actually following code according to sample example,

     

                        do

                        {

                            uint16_t length = (uint16_t)index;

                            err_code = ble_nus_data_send(&m_nus, data_array, &length, m_conn_handle);

                            if ((err_code != NRF_ERROR_INVALID_STATE) &&

                                (err_code != NRF_ERROR_RESOURCES) &&

                                (err_code != NRF_ERROR_NOT_FOUND))

                            {

                                APP_ERROR_CHECK(err_code);

                            }

                        } while (err_code == NRF_ERROR_RESOURCES);

     

    Which was wrong for sending continuous data.

Reply
  • The issue is resolved, We got the hint from the following link,

    https://devzone.nordicsemi.com/f/nordic-q-a/35647/send-packets-continuously-in-ble_app_uart-example

     

    The issue was we were getting the return value of NRF_ERROR_RESOURCES from the API ble_nus_data_send.

    This means that Stack is busy processing previous packet and in this case we need to wait till get the response with  the event BLE_EVT_TX_COMPLETE 

     

    We were actually following code according to sample example,

     

                        do

                        {

                            uint16_t length = (uint16_t)index;

                            err_code = ble_nus_data_send(&m_nus, data_array, &length, m_conn_handle);

                            if ((err_code != NRF_ERROR_INVALID_STATE) &&

                                (err_code != NRF_ERROR_RESOURCES) &&

                                (err_code != NRF_ERROR_NOT_FOUND))

                            {

                                APP_ERROR_CHECK(err_code);

                            }

                        } while (err_code == NRF_ERROR_RESOURCES);

     

    Which was wrong for sending continuous data.

Children
No Data
Related