This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3235S: Azure SDK data publication latency

Part Number: CC3235S

Hello everyone,

I have been using the Azure SDK to publish some data that is coming from a serial port into my IoT hub. I have an infinite loop that reads the data from the serial port and publishes it to the hub.

When I run the code to read the serial data without publishing it, it works smoothly. Similarly, when I publish random data to the IoT hub without reading serial data, it also works perfectly fine. However, when I use the publishing function inside the loop that reads the serial data, the code starts lagging, and only a few samples (2-3 seconds time interval) are published to the hub.

I assume the issue might be related to threads, but I'm not sure what could be wrong.

Any comments, suggestions, or solutions would be highly appreciated.

  • Please try to use 2 different threads. one that receives (and buffers) the data from the serial and the other to publish it. You can use any synchronization mechanism (e.g. message queue) to notify the "publishing" thread that more data is available.

    I'm not sure what is the context in which you are trying to publish, but it is not recommended to publish from an interrupt context.