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

nRF52832 notify every 20ms at 50 meters

Hi,

My setup :

  • nRF52832
  • Soft Device S132 v5
  • SDK14.2

My use case involve me to send data to to a central device at 50 meters. I need to send only a small data : one int16_t. I have a timer set up to do a SAADC conversion then send data (sd_ble_gatts_hvx) every 20ms.

It's working great on close range. But as soon as I am further than 5 meters I got a NRF_ERROR_RESOURCES.

Since it's not really a problem if I miss few data, my first try was to ignore it :

/* It's not a problem if we loose few data */
if(retval == NRF_ERROR_RESOURCES){
  retval = NRF_SUCCESS;
}

return retval;

It work great meaning that it does crash the board now and it keep sending data but at a very low speed and multiple packet at a time it looks like on the nRF Connect app log.

So I know that this error means that the queue is full. But why is it related to the distance from the central since it's a notification so we do not expect an acknowledgment or anything!?

Also when I go to ~25 meters (outside) not only I have very slow notification update on my central, but I got disconnect (Timeout).

What are the optimizations I can do to increase my range and keep my transmission speed constant?

Thanks

Parents
  • So I know that this error means that the queue is full. But why is it related to the distance from the central since it's a notification so we do not expect an acknowledgment or anything!?
    As points out you probably have a HW problem. Notification packets don't require acknowledgments from the application layer, but all BLE packets are actually acknowledged on the Link Layer. If your notification packet doesn't successfully reach the peer, it is retransmitted over and over again until the packet is either received successfully or until the supervision timeout times out and your device disconnects. This is probably why your queue fills up and why your link eventually breaks when you move out of range. 

  • The designer of the board tells me that there is no HW problem, he is used to work with nRF52 and he advised me to do an antenna tuning to take into account the materials and package surrounding my custom board. How am I suppose to do that?

    Also, he tells me that we can optimize the software to the detriment of the battery autonomy to increase the range. Do you know what is he referring to ?

    Thanks for your help

  • You can send me a PM with board info for review.

    Also, Nordic have a similar system set up.  Just search in the devzone for info on how to do this privately.  I think the process changed with the new website.

    Sorry I can't help you on sending packets without acknowledgment/retransmission.  The software layers really isn't my thing. 

    Since you just need to send 16 bits, you could easily use the beacon app to send the data.  There is plenty of room if you use major/minor (total 32 bits). Beacons by definition don't have an ack since it is non-connectable.  This could be a easy way to solve your issue. At 100 meters, I think you would get through about 20% of your beacons and close to 100% at 50 meters. Not sure how you would handle encryption if you are worried about someone seeing the data or spoofing your setup.

  • If you have changed or added packaging the designer is absolutely right. A device should always be tuned after it is placed in its intended enclosure. Nordic offers free tuning and if you want I can give you an address you can ship it to and we will do the tuning in our lab. 

    He could be referring to the TX power. The default TX power (at least in our examples) is 0 dBm and you can try to increase this to 4 dBm. That should increase your range, but the radio will also consume ~40% more power: Radio current consumption (Transmitter)

  • Ok, should I use the sd_ble_gap_tx_power_set like in the ble_app_proximity example ? I will give it a try

  • Yes, that is correct. Just remember to use it after you have initialized the Softdevice. Otherwise your setting will be overwritten and set back to 0 dBm. 

  • Still got  <error> app: ERROR 19 [Unknown error code] for sd_ble_gatts_hvx function as soon as I am > 5 meters.

    sd_ble_gap_tx_power_set doesn't change my results.

    Tw power -> RSSI :

    • -40 : -90dBm
    • -20 : -80dBm
    • -16 : -75dBm
    • -12 : -67dBm
    • -8 : -64dBm
    • -4 : -60dBm
    • 0 : -55dBm
    • 3 : -55dBm
    • 4 : -51dBm
Reply Children
No Data
Related