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

How to limit BLE 5 range in nRF52840 to 5m in ble_app_uart?

Hi,

Board: nRF52840 PCA10056 Development kit

Keiluvision 5

SoftDevice : S140

nRF-SDK 15.2

SDK example code: ble_app_uart

Hi, I want to change the BLE range to 5 meters, so I tried this function as belows:

uint32_t err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_advertising.adv_handle,-20);
APP_ERROR_CHECK(err_code);  

I got the change in range upto 9m but when I try to reduce it further to -40db I face issue while connecting again, I had to take my smartphone to the closest to the board to get connected again. This should not happen as it is getting connected and disconnected at  -20db properly. So, I think it should work like same at -40 db. Please help urgently and guide that what changes need to be done in the code. 

Thanks for your support

Parents
  • Are you saying that with the -40dBm setting you can connect at 2 ft, and you are disconnected at 10 feet? But you cannot reconnect at a longer distance than 2 feet?

    Can you confirm if there are any other scanners in the area, especially active scanners? You should also check with a sniffer to see if the central is able to receive the advertisement packet and actually sends a connection request. Also note that the connection request is a one off, i.e. if you have an error in this packet the connection will never be established (by the peripheral, while the central will send 6 packets to try to establish the connection). but when you are in a connection you can loose several packets without loosing the link, the number of packets depending on your connection parameters.

  • Yes, you got it correct at -40dB, setting I can connect at 2 ft and disconnection at 10 feet but cant reconnect at longer distance than 2 ft. No, there are no active scanners in the area. Central is not able to receive advertisement packets from peripheral. 

  • Do you have a sniffer log? this will show if there are any scan or connection request and also the rssi value of the packets at the sniffer.

Reply Children
No Data
Related