This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF9160: Serial LTE modem + MQTT publish

Hi

This question is based on the NCS tag v1.8.0.

I am using nRF9160DK SLM application to evaluate the MQTT AT command function.

I got OK if I send a plain text to AWS. But I got an ERROR when I try to send message in JSON format like example above.

2022-01-25T08:22:14.024Z DEBUG modem << #XMQTTCON: 1,"nrf9160_Thing","MY_ENDPOINT-ats.iot.us-west-2.amazonaws.com",8883,16842753
2022-01-25T08:22:14.027Z DEBUG modem << OK
2022-01-25T08:22:28.864Z DEBUG modem >> AT#XMQTTPUB="topic/test","Test message with QoS 1",1,0
2022-01-25T08:22:28.885Z DEBUG modem << OK
2022-01-25T08:25:18.424Z DEBUG modem >> AT#XMQTTPUB="topic/test" {"msg":"Test Json publish"}
2022-01-25T08:25:18.435Z DEBUG modem << ERROR
2022-01-25T08:25:18.436Z ERROR Error: AT#XMQTTPUB="topic/test" {"msg":"Test Json publish"}
 failed

Does anyone know the right format to send JSON format AT command to serial LTE modem in v1.8.0?

Best regards,

Tim

Parents
  • Hi Tim,

    The correct way should be like the following steps:

    1. AT#XMQTTPUB="nrf91/slm/mqtt/topic0"  #enable slm data mode

    2. {"msg":"Test Json publish"}    # json format content, could be data in any format

    3. +++    #Exit slm data mode. Link Monitor attaches CRLF always, this will not stop slm data mode, use serial terminals like use Teraterm, Termite on Windows and Cutecome on Ubuntu, they support sending only +++. 

    Best regards,

    Charlie

  • Hi Charlie,

    Thanks for your reply. I finally figured out why Link Monitor keeps sending me timed-out ERROR after I enabled data mode.Sweat smile

    Best regards,

    Tim

     

Reply Children
No Data
Related