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

MQTT return ERROR after 24 hours

Hello!

 I am sending MQTT commands over UART from an NRF52840 DK to the NRF9160 DK which has the ibasis sim card inside. I noticed 3 times so far that after 24 hours , 1 hour tolerance, I get only  ERROR messages returned after sending the MQTT commands with the payload.  Basically I need to reset the NRF52840 DK and  re-send all the MQTT commands for connecting to the MQTT broker, autenthificating, opening connection and initialising the modem ( AT+CFUN = 1 etc) .

 I was wondering if there were previous experiences like this.  I did use an osciloscope and the NRF52840 DK is sending the right commands with the good payload over UART even after 24 hours, it's just like the modem closes the connection or something...

All the best,

Robert.

Parents
  • Hi, Robert!

    Thank you for reaching out! You're saying that you have to call AT+CFUN=1 in addition to all the MQTT procedures. This means that the modem has shut down at some point. Could you provide a short description of your application's behavior? How often does it upload data, and what does it do in between?

    What kind of MQTT broker are you connecting to? It may be that it has some restrictions/timeouts for connected devices.

    Any logs from the nRF9160 would also be appreciated. Please add "CONFIG_SLM_LOG_LEVEL_DBG=y" in the prj.conf.

    Best regards,
    Carl Richard

  •  Thank you for the prompt reply, Richard!

     I will ad the "CONFIG_SLM_LOG_LEVEL_DBG=y" now to the NRF9160 and start it again. Until then:

     

    - I am using a mosquitto on a google virtual macine to which I connect using username and password. Used before same set up but instead of the NRF9160 I used a raspberry to publish the data to the broker.  The NRF52840 was sending the data over USB to the raspberry and the raspberry to mqtt.

    - the succesion of commands I give out when the NRF52840 starts running AT\r\n ; AT+CFUN=1\r\n ; AT+CFUN?\r\n ; AT#XMQTTCON=1,"test","USER_HERE","PASSWORD_HERE","34.105.208.xxx",10803\r\n ;  AT#XMQTTPUB="gw-event/received_data/",1,"PAYLOAD_HERE",1,0\r\n ; 

    - the NRF52840 gets data over bluetooth from beacons and send the data over UART to the NRF9160; 

     

    - testing phase now so only sends out data once every 24s , in between it does nothing , the nrf9160 runs in normal mode; once data is received over uart then callback function is triggerred and publishes the data over mqtt; 

    - will get back to you with the logs also, once I have them;

    All the best,

    Robert!

  • Hi again!

    Great. I'll await your logs. Just to confirm: are you using the Serial LTE Modem(SLM) sample for the nRF9160, or your own custom code? My suggested config will only work with the SLM, so if you're using a custom application just post your most verbose logs.

    RobertT said:
    the succesion of commands I give out when the NRF52840 starts running AT\r\n ; AT+CFUN=1\r\n ; AT+CFUN?\r\n ; AT#XMQTTCON=1,"test","USER_HERE","PASSWORD_HERE","34.105.208.xxx",10803\r\n ;  AT#XMQTTPUB="gw-event/received_data/",1,"PAYLOAD_HERE",1,0\r\n ; 

    This seems okay. Do you have to call "AT+CFUN=1" when the MQTT errors starts occurring, or is it enough to do the MQTT connection procedure?

    Note that Easter holiday is approaching, so answers may be delayed until next Tuesday (6th of April).

    Best regards,
    Carl Richard

  • Yes, Serial LTE Modem(SLM)  . When I hit " Reset " on the nrf52840 it sends the succesion of commands again and everything start working. Will try and separate the commands to see which one makes everything working again.

  • Hi again!
    Have you had any progress?

    Best regards,
    Carl Richard

Reply Children
Related