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.

  • Hi again, Robert!

    Thanks for the logs. The MQTT AT-Commands seems to be malformed somehow, resulting in the nRF9160 returning an error. See below:

    10> T#XMQTTPUB="gw-event/received_data/",1,"$P1~
    10> [05:20:21.881,256] <dbg> at_cmd.at_cmd_write: Awaiting response for T#XMQTTPUB="gw-event/received_data/",1,"$P1~

    Here the "A" in "AT" is missing, and the message is cut short as well. Could check if the correct AT command is sent from the host device? This could also be related to buffer sizes, so if possible please share a full length AT command with me so I could check that.

    For later logs please add CONFIG_LOG_STRDUP_MAX_STRING=256 in your prj.conf, since the messages currently are too long to be displayed.

    Best regards,
    Carl Richard

  •  Hello again!

     I attach the 2 log files, terminal and data, with the added CONFIG_LOG_STRDUP_MAX_STRING=256 .

    This are the commands that I send out : 

    1 - > "AT\r\n";
    2 - > "AT+CFUN=1\r\n";
    3 - > "AT+CFUN?\r\n";
    4 - >"AT#XMQTTCON=1,\"test\",\"user\",\"12345678\",\"34.105.xxx.xxx\",10803\r\n";
    5 - > * here I add the information received from a sensor* - >  AT#XMQTTPUB=\"gw-event/received_data/\",1,\"$P11,2128,211,1111,52.23445786825217,0.1434466448266854,Car,CR\",1,0\r\n";

    All the best,

    Robert.

    # SEGGER J-Link RTT Viewer V6.98b Data Log File
    # Compiled: 15:05:00 on Mar 12 2021
    # Logging started @ 15 Apr 2021 09:39:07
    
    # Logging stopped @ 19 Apr 2021 18:11:05
    
    logs55.log

  • Hi again!

    Based on the logs the nRF9160 still isn't receiving the complete MQTT AT commands. I'm not sure what's happening, but could you try to set CONFIG_AT_CMD_LOG_LEVEL_DBG=y for the next run as well. This will give us more verbose logs.

    In addition, could you try to connect to a more simple MQTT broker, for example:

    AT#XMQTTCON=1,"nRF9160_apr_test_21","","","test.mosquitto.org",1883

    So that we can rule out any issues with the particular broker connection.

    Best regards,
    Carl Richard

  •  Did a second set-up, mirroring the first one, but with the mqtt broker from above and also added the setting in .proj file. I am live here : sudo mosquitto_sub -t nRF9160_apr_test_21 -h test.mosquitto.org -p 1883 , when the sensors transmit. 

     When  the modem goes offline / off again will get back to you.  

    They both run in parallel to see if they go down in the same time, etc.

    Will get back once they fail.

    All the best,

    Robert.

Related