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

Regular current spikes on modified MQTT simple

Hello!

H.W: nRF9160 DK v8.5
MWF: 1.1
NCS: tag 1.2
SIM: Telenor NB-IoT

I'm using a modified version of the MQTT simple example for an application that periodically uploads data to a privately hosted broker. The MQTT functionality have been moved to a separate file and modified so that the main loop of the original example is run as a separate thread, handling the MQTT operations.  

In addition I'm using PSM and an upload timing scheme similar to the one in the udp_with_psm example. The MQTT keepalive is set to the PSM TAU period (~300 seconds) in order to avoid unnecessary wake up during the sleep cycle. 

When looking at the power consumption of the example in a power analyser I see that the application consistently has power spikes of ~8mA every ~6 seconds. Do you have any suggestions to how I can avoid these? I have confirmed that it is related to the MQTT operation as the spikes aren't present otherwise, but I struggle to find out exactly what is causing them. 

EDIT: The intervals seems to be of increasing length between each TAU. From what I can see it starts with very short intervals (~600 ms), and then it increases gradually all the way up to ~12s. This seems to reset every time the modem wakes up and transmits. (it's a bit hard to make out the actual intervals during the transmission as it's cluttered with paging spikes)

Attached is a snapshot from the power analyser. The red graph is the MQTT current, the green one is the current of a CoAP application with the same configuration for comparison. 



Do tell if I should provide any more information or code. 

Thanks in advance.

-- Carl Richard

Parents
  • The only thing I can think of right now is that the if you are doing a DNS query the DNS timer may be running for a while after the DNS resolution has finished. So if you are using host names in your code try to use plain IP addresses instead. However, if there is a timer running I would expect to see a more consistent interval between the spikes.

    What is the resolution on the power analyzer? And are you able to zoom in to one of the spikes? The current profile of the spike might tell us what to look for next.

Reply
  • The only thing I can think of right now is that the if you are doing a DNS query the DNS timer may be running for a while after the DNS resolution has finished. So if you are using host names in your code try to use plain IP addresses instead. However, if there is a timer running I would expect to see a more consistent interval between the spikes.

    What is the resolution on the power analyzer? And are you able to zoom in to one of the spikes? The current profile of the spike might tell us what to look for next.

Children
Related