Advertizing 20 custom parameters as perfipheral - NRF52832 BLE

Dears,

Is it possible to rework the heart rate example (BLE) for the client and peripheral, so instead of heart rate to advertise and receive by the client 20 custom parameters (all they are uint16_t)? What changes shall I do (general conception).

Best Regards,

Stanislav

Parents
  • Hi,

    The Advertisement PDU within a BLE packet does only have 37 bytes available for data, where 6 of these bytes are reserved for the Bluetooth address of the advertising data resulting in maximum 31 bytes of user data. 20x16 bits, or 40 bytes, will exceed this.

    Within the limitations I've just mentioned it should not be any issues to rework the sample to advertise other custom parameters instead

    See https://academy.nordicsemi.com/topic/advertisement-packet/ for more details

    PS: You can also add up to 31 bytes within a scan response pack so if you split your 40 bytes into these two types of packets you should be able to transmit the 40 bytes

    Let me know if this answers your questions

    Kind regards,
    Andreas

  • Thanks. It is clear about the limitations and will stick to them. Can you point out which files in the client and perirenal example for heart rate transmission in BLE  contain definitions of the advertised data sent and expected, so I can update them by adding additional parameters?

  • You must follow the definitions and flow for bt_data ad and bt_data sd to see how data is defined and added to the advertisement and scan response data structs. https://academy.nordicsemi.com/topic/blefund-lesson-2-exercise-1/ showcases how to do this with a minimal sample. Comparing this to the hr central sample you will see that there is defined multipled elements using BT_DATA_BYTES, where the last of them in the advertise data packet contains the custom Heart Rate Sensor value.

    Line 35 and 44 in main.c in central_and_peripheral_hr 

    Kind regards,
    Andreas

  • I looked at the ad[] structure and got the idea. Still, when looking at how those values are updated, I saw specific functions prepared and ending up with bt_gatt_notify. So I need to prepare functions per each parameter and link it to bt_gat_notify? My intention is just to set 20 parameters and advertise them, change them in the main loop, and that's all. The client should receive them. There were many parameters stated in uuid.h. Are there specific functions created for each of them, so I can use them to update the values?

    Exercise 2 from the nordic academy you pointed out looks promising. There, by pressing the button, you can change the advertised data. Can I do something similar but instead of a button, to wait for a character from the Serial interface and advertise the received character? Are there any restrictions (interrupts conflict, timers, etc that forbid using the advertising and the UART at the same time?

Reply
  • I looked at the ad[] structure and got the idea. Still, when looking at how those values are updated, I saw specific functions prepared and ending up with bt_gatt_notify. So I need to prepare functions per each parameter and link it to bt_gat_notify? My intention is just to set 20 parameters and advertise them, change them in the main loop, and that's all. The client should receive them. There were many parameters stated in uuid.h. Are there specific functions created for each of them, so I can use them to update the values?

    Exercise 2 from the nordic academy you pointed out looks promising. There, by pressing the button, you can change the advertised data. Can I do something similar but instead of a button, to wait for a character from the Serial interface and advertise the received character? Are there any restrictions (interrupts conflict, timers, etc that forbid using the advertising and the UART at the same time?

Children
No Data
Related