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

my bluetooth gets disconnected while sending continous stream of data

hi, i am using uart example from nrf51822 example. when i am sending continuous stream of data then my connection breaks. it disconnects from peripheral device. how should i overcome from this situation. i think i am missing some data exchange concept for sending devices based on connection interval and all different parameters.

can anyone please guide me what should i do to make connection live while sending continuous data over ble uart.

thanks!!

Parents
  • Hi, you might be using the NUS example. Can you tell me what SDK you are using?

    Also can you tell me how you "send continuous stream"?

    As you know, when using ble_nus_send_string, the maximum length is 20.

    Are you calling ble_nus_send_string mutiple times like this?

    for(uint16_t k = 0 ; k < 1000 ; k++) {
          err_code = ble_nus_send_string(&m_nus, (uint8_t *) "Hello World", 11);
          APP_ERROR_CHECK(err_code); // a bad way in my opinion
    }
    

    Or are you using BLE_EVT_TX_COMPLETE to taking care of this?

    You will get an BLE_EVT_TX_COMPLETE every time a packet you have queued for transmission.
    

    (ref. link)

    Before I answer your question, I expect you'll get an error when calling ble_nus_send_string.

    So the device resets and disconnects. Can you check the error code?

Reply
  • Hi, you might be using the NUS example. Can you tell me what SDK you are using?

    Also can you tell me how you "send continuous stream"?

    As you know, when using ble_nus_send_string, the maximum length is 20.

    Are you calling ble_nus_send_string mutiple times like this?

    for(uint16_t k = 0 ; k < 1000 ; k++) {
          err_code = ble_nus_send_string(&m_nus, (uint8_t *) "Hello World", 11);
          APP_ERROR_CHECK(err_code); // a bad way in my opinion
    }
    

    Or are you using BLE_EVT_TX_COMPLETE to taking care of this?

    You will get an BLE_EVT_TX_COMPLETE every time a packet you have queued for transmission.
    

    (ref. link)

    Before I answer your question, I expect you'll get an error when calling ble_nus_send_string.

    So the device resets and disconnects. Can you check the error code?

Children
No Data
Related