NB-IoT post data using AT Commands and MQTT to ThingSpeak

I would like to evaluate the use of NB-IoT in the UK which Wireless Logic SIM included with nrf9151DK provides. Using the following sequence of AT commands I can send data over LTE-M to thingspeak but if I try the same sequence with NB-IoT as the mode and preference (i.e. AT%XSYSTEMMODE=0,1,0,2) i get ERROR response when i try to connect using AT#XMQTTCON instead of OK when using LTE-M. Can you advise where I may be going wrong please? I am using the Serial LTE Modem application in nrfConnect. 

  • AT#XRESET
  • AT%XSYSTEMMODE=1,1,0,1
  • AT+CFUN=1
  • AT+CEREG=5
  • AT+CSCON=1
  • AT+CGDCONT=1,"IP","APN HERE"
  • AT+CESQ=0
  • AT#XMQTTCFG="CLIENT ID HERE",300,1
  • AT#XMQTTCON=1,"USER NAME HERE","PASSWORD HERE","mqtt3.thingspeak.com",1883
  • AT#XMQTTPUB="TOPIC HERE","DATA HERE"
Parents Reply Children
  • I have not been able to use the same setup as you, but just testing with basic public brokers works just fine;

    at#xmqttcon=1,"","","test.mosquitto.org",1883
    
    OK
    
    #XMQTTEVT: 0,0
    
    +CEREG: 5,"A879","014A0303",9,,,"11100000","11100000"
    
    at%xsystemmode?
    
    %XSYSTEMMODE: 0,1,0,2

    I would assume this basic test should also work for you. If it does, then maybe I can try to replicate your setup more closely. If necessary, we can make the ticket private, so you can share more details.

  • Can you include all of your setup AT commands so that I can try to respoduce your result? This cant be everything as you need to turn the modem on.

    Thanks

    Gavin

  • It is pretty much exactly what you did, setting AT%XSYSTEMMODE=0,1,0,2So setting something like

    AT%XSYSTEMMODE=0,1,0,2
    
    at+cfun=1
    
    at#xmqttcfg="something123",300,1
    
    at#xmqttcon=1,"","","test.mosquitto.org",1883
    
    OK
    
    #XMQTTEVT: 0,0
    
    +CEREG: 5,"A879","014A0303",9,,,"11100000","11100000"
    
    at%xsystemmode?
    
    %XSYSTEMMODE: 0,1,0,2

    The broker seems to be down at the moment, but it was up and working when I was testing it earlier.

  • Hi Hakon,

    I have tried your AT commands and similar to your second attempt it wont connect and produces ERROR. It would be good if it said something more than just ERROR.

    Does the latest firmware mfw_nrf91x1_2.0.2 support MQTT for NB-IoT using AT Commands?

    After trying for some time I have still been unable to send a single message via NB-IoT using MQTT yet LTE-M works perfect.

    Do you have any further advice to get this working?

    Thanks again,

    Gavin

  • gav_ncl said:
    I have tried your AT commands and similar to your second attempt it wont connect and produces ERROR. It would be good if it said something more than just ERROR.

    Does it time out, or is it an instant error? If it times out, then you should try a different broker.

    gav_ncl said:
    Does the latest firmware mfw_nrf91x1_2.0.2 support MQTT for NB-IoT using AT Commands?

    It should be supported as far as I know.

Related