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

how to send 100 plus packets in a single structure or string

hello i am using sdk 16 with nrf52830 dvk i have interfaced accelarometer sensor and created a timestamp using internal rtc now i want to send 100 packets(accelarometer data ) every second in a single structure or array or string using rtc instance.I have tired to send it as a string but could not be able to send the entire string in a single ble instance

  • Hello, manikandan v

    now i want to send 100 packets(accelarometer data ) every second in a single structure or array or string using rtc instance.I have tired to send it as a string but could not be able to send the entire string in a single ble instance

    Could you clarify for me whether you are looking to send 100 packets per second, or a single packet containing 100 measurements every second?
    I do not understand which you are after.

    Either way, you could do this using notifications. You can see this demonstrated in ble_nus_data_send function the Nordic UART example of the SDK. You could do something similar, and have a notification queued every time data is ready for transport, and then select and appropriate connection interval to achieve the desired latency. 

    kindly check my code and give suggestions

    First and foremost, you will need to check the error codes returned by your calls to ble_nus_data_send. You should always check the returned error code when using functions from the SDK that return error codes. If you do not, then you will have no way of knowing if a function call succeeded or not. Additionally, the non-NRF_SUCCESS error code will often tell you why it failed.
    Please also make sure that you have defined DEBUG in your preprocessor defines, like shown in the included image.


    Furthermore, You exclusively use magic numbers in your code. I would stop this immediately, as it severely reduces the readability and robustness of your code.

    Please add the error checks and DEBUG define to your code, and let me know what is printed to your logger output when the code reaches the ble_nus_data_send function that does not work.

    Looking forward to resolving this issue together,

    Best regards,
    Karl

Related