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

Problem with simultaneous transmission and reception

Hi all again guys! I am experiencing a problem with my application: i have a beacon that is sending ADC converted values to a nrf51 DK (via notification), which is connected to the pc to receive these values via USB and visualize them; from the pc, i also send back some values at precise moments to the beacon, via write without response, so that the transmission is bi-directional. What happens is that sometimes (it seems pretty much random, other times it all goes good with no problems), when i decide to send some numbers from the PC using the write operation (while of course i am still receiving notifications simultaneously), this causes a disconnection between the two devices (i think probably because of an error occurring in these operations), with consequent loss of data sent by notification, that should be continuous and real-time. What could be the problem? Isn't the nrf51 capable of handling both transmission and reception simultaneously? Please note that my connection parameters between the two devices are 10 ms of connection interval, and 0 slave latency.

Thanks in advance and tell me if any other information are needed!

projects.rar

  • It is capable. I have no idea what you are doing, so it is difficult to say what the problem could be. You give the impression that it works when you don't send numbers from the PC? Maybe you can edit your question and add the relevant parts?

  • Ok sorry, my first goal was to understand if it was capable or not, now i know that there should be a problem in the code. Yes, when i DON'T send numbers, the transmission from the beacon (peripheral) to the DK (central) works perfectly, the problem arises randomly (though pretty often) with the opposite way. I uploaded the zip (you probably already saw it because you helped me with older problems about it) with both the files loaded on the beacon and the ones for the DK, i put both of them because i don't know which of the two devices makes this disconnection problem, even though of course is the DK that makes the write operation while receiving notifications by the beacon. Always really thanks for your help.

    I resume briefly the two codes:

    BEACON SIDE: converts with the ADC every 2 ms, then save the result filling five packet of 20 bytes, then sends them via notification to the DK

    DK SIDE: receives the notification after doing db discovery of the service of the beacon, then sends them via uart to the pc; when from the pc i write an array of 13 integer and send them via UART to the DK, it gets an event and writes these values on the beacon, on a appropriate characteristic (for doing this, there is a control of the 10th value of the array that must be nonzero).

  • I would also suspect that error is in the central. But I would still confirm this. What you can do is to check if you get the BLE_GAP_EVT_DISCONNECTED event on either side, and check what the reason is p_ble_evt->evt.gap_evt.params.disconnected.reason. I would also put a breakpoint in app_error_handler(), to see if you get any errors somewhere.

  • Today i did some testing, and i noticed that the disconnection happens a lot less times, though still occurs, i can't really explain this... in addition, as you can see on the peripheral i want to put out in serial the numbers sent with the write operation, but checking with the oscilloscope i don't get the numbers with app uart put; maybe this usage of app uart put can someway cause also the problem? If you could check when you have time the code part pc-->DK-->beacon-->app uart put i would be really grateful...

    P.S i checked the case of disconnection on the central side, and the reason is "08", which seems to be from the table of the softdevice a connection timeout, i don't understand how it is possible...

  • I will check your code when I have time, but please check the stuff I mentioned above.

Related