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

nRF52832 firmware design approach

hello I am using nrf52832. I am advertising some data and scanning (on the same microcontroller) for other nrf52 devices(which will have the same firmware). When the other nrf52 comes closer than certain rssi threshold, I have to transmit this other device data(self ID, other device ID, rssi) to the gateway (which is based on esp32). I have completed the advertising, scanning and getting the data that needs to be sent to the gateway. However, I need suggestion as to how to send this data to the gateway. I am considering two options.

Option 1: I modify the advertisement packet and include this new data that should be sent to the gateway. The gateway will scan for the devices and get the advertisement and decode the required data. But this modified advertisement should be sent only once and go back to default advertisement after that. And this modified advertisement will be different for different device. I tried to use radio notification interrupt to know that the modified packet has been advertised so that I can update it to default advertisement using ble_advertising_advdata_update but somehow it is not working. I can further work on this if it is a good approach.

Option 2: I can make a separate service like nordic Uart and advertise it once I need to send data to the gateway. The gateway scans with this service name, and get the data. For this, I need to add another service and advertise it, along-with already default advertisement and scanning. Also, once I send the data to the gateway using nordic uart, I can stop the nordic uart advertisement and service, and go back to default advertisement and scanning which is running to know if other nrf52 devices have come closer or not

Option 3: You can tell me if above two options are not suitable.

P.S. I am using Segger Embedded Studio and SDK 15.3. I am using nrf52 DK but I need to upload this to nrf52832 custom board.

Regards,

Sheryar Shahzad

  • Hello,

    Ok, so you want to measure RSSI between many devices, and send some data to a gateway when needed, right?

    And if I understand correctly, you are already done with the advertising and scanning part that is done on the nodes, to detect the RSSI, right?

    And now you need to send this data to the gateway?

    Option 1: You should be able to use radio notifications together with advertising and scanning. What sort of issue are you running into?

    You probably don't need to use radio notifications, even though it is possible. You can just use a timer set to 1.5 advertising interval. 

    However: Even if you know that the advertisement has been sent, you have no guarantee that the gateway has picked it up. The packet may be lost due to noise, or if the gateway is already in the middle of another advertising packet from one of the other nodes. So you should let the device advertise these messages for many advertising intervals if you want to increase the probability for the gateway to pick it up (still not guaranteed). 

    Option 2: A connection will ensure that the message that you are sending is successfully received by the gateway. The downside is that this takes time, because they have to connect, the gateway needs to enable notifications, and then receive the notification from the service/characteristic, instead of just receiving an advertisement packet. 

    I would say that option 2 is your best option, but it depends on the number of nodes you are going to use. If you have 20 nodes, it shouldn't be a problem to connect to any nodes that request it, if they request it once in a while. But if you have 1000 nodes, you may struggle to keep up with the nodes that want to connect.

    So if you have too many nodes (the number depends on the advertising interval that you need), I would imagine that the best option would be to change advertisements, but leave them advertising like this for a lot longer than one advertisement. Why do you need to change it back?

    Best regards,

    Edvin

Related