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

How to receive the int type valuse in nrf52832 from the other nrf52832

I'm developing multiple peripheral and a central. Central is only scanning and Peripherals are only advertising.

In the example, I see that I should use the ble_app_blinky as peripheral ,and ble_app_multilink_central as central.
In my project, the advertising data is a SAADC value which sampling by nrf52832, integer type.

I want to advertise it from two nrf52832 to the other nrf52832.

Does anyone tell me how to realize it? I think the advertising data will be encode,so the scan data how to be decode?
Thank you!

Parents
  • Hello,

    Do you want to send the SAADC data using the advertising packs only, or do you want to connect the devices?

     

    The advantage of connecting is that you can prevent packet loss. When you only scan for advertising packs, there is no guarantee that the packet will arrive, and there is no way of finding out whether you missed a packet, and retransmit that packet. If you are in a connection, the lost packages will automatically be retransmitted by the Softdevice.

     

    Depending on the answer on the question above, the implementation will be a bit different. Note that in order to change the advertising data, you need to stop the advertising, update the advertising data, and restart the advertising again. It is not complicated, but you need to follow these steps in order for the softdevice to change the advertising data.

     

    If you connect the devices, you can use notifications (most of our examples use this) to transmit the SAADC results. Just be aware that the blinky service (LBS service) only contains one byte. You might want to replace the lbs_c servide in the ble_app_multilink_central example with the nus_c service, so that the peripherals can send multiple bytes of payload data in one packet.

     

    To set up the SAADC in the example should be pretty straight forward. Just copy the parts from the main.c in the saadc example into your peripheral application. Just remember that the softdevice uses TIMER0, so you need to change the timer used in the application. Remember to enable it in sdk_config.h.

     

    Best regards,

    Edvin

  • I want to send the array sampled by two nrf52832 to the other nrf52832. The reason why I use ble_app_multilink_central is that Infocenter say it can link multi peripheral.

Reply Children
Related