Hi, Community!
My development environment is the following:
- SDK52,
- nRF52840,
- s140 17.2.0
- nRF Sniffer
My problem is that I can not seem to be able to send more than one packet per connection interval. I have two nRF52840 devices that negotiate a 7.5 ms connection interval and I set aside 6 units for the NRF_SDH_BLE_GAP_EVENT_LENGTH. I have enabled DLE 251 and ATT MTU 247. I have also enabled the 2 M PHY speed. According to calculations, these parameters should result in 2-5 packets per connection interval. After the negotiation, the peripheral starts to send 244-byte chunks of data to the master, in a continuous loop. The code in main() is the following:
// Enter main loop. for (;;) { //If everything is negotiated correctly, start sending the messages. if (phy_negotiated == true && conn_interval_negotiated == true ) { //The length of a message uint16_t length = 244; for (int i=0; i<1000; i++) { //Change between two different arrays every other time if (i%2 == 0) { //Array filled with the value 'A' p_byte_array = byte_array_A; } else { //Array filled with the value 'B' p_byte_array = byte_array_B; } do { //Send selected array err_code = ble_nus_data_send(&m_nus, p_byte_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); } } idle_state_handle(); }
When I observe the communication with the nRF Sniffer in Wireshark, I can see that only one packet is sent per connection interval. I tested to raise the interval to 300 ms and NRF_SDH_BLE_GAP_EVENT_LENGTH to 240 units (=300 ms), yet still there is only one packet sent. Here is a snippet:
As you can see in the picture, the master opens the connection interval with a 44 us (2 M PHY) packet at every ~300.000 us. This is because I had set the interval to 300 ms. There after, the slave answers with a 251-byte packet that takes 1048 us, which is expected. However, the "More Data" column shows "False" which results in the closing of the connection interval.
What could be the problem? Please help me find a solution!