Is the NUS service speed limited by distance?

Hi,

I’m streaming high-rate sensor data over BLE with an nRF52840 running NCS v2.9.0.

  • Data rate: 1 kHz, ≈ 8 400 B/s

  • Packing: 5 samples → 42-byte packet, pushed into an msgq

  • Sending: A dedicated thread dequeues the packets and transmits them with bt_nus_send().

At very short range (0.3 – 0.5 m) everything is stable.
When the distance increases to 0.5 – 2 m, the msg gradually fills, and packet-loss grows with distance (≈ 2 % at 0.6 m, ≈ 32 % at 2 m). bt_nus_send() rarely returns an error, yet queue overflows and packet drops occur simultaneously.

Is such a sharp drop in throughput over this distance typical for the Nordic UART Service, or am I likely missing a configuration step (connection interval, PHY, MTU / DLE, flow control, etc.)?
Any recommendations on parameters or best practices to maintain ~8 kB/s without loss would be greatly appreciated.

the prj.conf as following:

# add BT peripheral rola support ad
CONFIG_BT_PERIPHERAL=y
# enable updata BT connect param
CONFIG_BT_GATT_CLIENT=y     
CONFIG_BT_USER_PHY_UPDATE=y 
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=24   
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=24
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400   
CONFIG_BT_USER_DATA_LEN_UPDATE=y 
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=4000000
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_KEYS_OVERWRITE_OLDEST=y

CONFIG_BT_MAX_CONN=1
#Enable the NUS service
CONFIG_BT_NUS=y

Thank you!

Best regards,

Ben

  • Sounds like bad antenna or (rare) bad HFXO crystal.

    You usually get roughly 1-2m range with a completely open antenna port for BTLE connections.

  • Hi Turbo,

    Thanks for your reply!

    At first I also suspected that it was an antenna problem, but when we tried using 250hz, there was no problem within a distance of 12m. So I think it might not be a hardware problem, i will also ask our hardware engineer to double check.

    Best Regards!

    Ben

  • Hi Ben,

    There might be some room for improvement in the hardware side. If you would like to share, I can check the schematic and layout for RF front-end to see if there is any major issue. Also you can increase output power up to 8 dBm as well. 
    Other than hardware, in software side, as you mentioned you are experiencing high packet loss which explain the reason why you are losing communication range. When there is a packet loss, the packet is re-transmitted until the packet is ok or connection ends. So when there are a lot of them, it means there are a lot of re-transmission which lead to reduction in throughput. So in your case even though you have 8 KB per second data rate, but actually the radio is repeating a good portion of the packets probably for multiple times.
    I would suggest reducing MTU in your setting as it make sure that in each transmission you are sending less data and thus it will reduce the packet loss probability. Hopefully it can improve your link range. 

Related