Why can i not connect my saraR510 to the mqtt broker with AT Commands

Hello,

i have an sparkfun u-blox SARA-R510M8S board. And i like to test the Mqtt AT Commands, before i send it with my stm32 microcontroller.
So i like to connect the board to my mqtt broker on my server to send messages.
I connected the board over the uart1 usb c port with my computer.
I opened with putty on com4 with 115200 baut an command line.
So here i can add all my commands to configure my module.
If i paste AT i get the answer OK

With the sparkfun board i got an hologram sim card. And its connects easy to the internet. This command give me the internet information back:

AT+UCELLINFO?
 
AT+UCELLINFO?
 
+UCELLINFO: 0,5,262,03,10431253,387,3CC9,70,21,255
 
+UCELLINFO: 0,6,6200,388,65,6

The next step is the mqtt connection. This are the commands from the manual topic MQTT from page 374, which i executed:

AT+UMQTT=12,1
 
ERROR
 
AT+UMQTT=0,"352753090041680"
 
OK
 
AT+UMQTT=1,1883
 
ERROR
 
AT+UMQTT=2,"109.123.250.139"
 
OK
 
AT+UMQTT=3,"109.123.250.139",1883
 
OK
 
AT+UMQTT=4,"user","pwd"
 
OK
 
AT+UMQTT=6,1
 
OK
 
AT+UMQTT=7,1
 
OK
 
AT+UMQTT=9,"Unrequesteddisconnect"
 
OK
 
AT+UMQTT=10,3600
 
OK
 
AT+UMQTT=11,1,2
 
OK
 
AT+UMQTTC=1
 
ERROR
 
AT+UMQTTNV=2
 
OK

So i cant set the local mqtt port with AT+UMQTT=1,1883 and i cant start the connection with AT+UMQTTC=1, both times i got an error back.

Is there somebody which can help me with this problem. Or do i have forgotten an command to activate Mqtt functionallity ?

best regards

Those use a custom set of AT commands, see https://cdn.sparkfun.com/assets/b/6/2/4/5/SARA-R5_ATCommands__UBX-19047455_.pdf and try the versions in this pdf

Hello @TS-Russell ,
i used exactly the commands from this manual. I have written the commands in my post which i used. This is the command to login to my mqtt server, after i configured everthing:
MQTT login
Set AT+UMQTTC=1 ->> ERROR.

But why i got an error. Can i see a log or something else to see what is going wrong ?

1 Like

Ah, gotcha

Can you maybe try an alternative test MQTT service to rule out local stuff as a potential issue?

As for the error codes, the AWS docs really leave a lot to be desired :-/

Hello @TS-Russell ,
i dont now how i can test mqtt on a another way.
The only option is maybe another mqtt broker to test the connection.
Maybe i can write log or i can change the log level .
I also ask in the ublox community, but nobody reacts to my post.
Is there an way to contact ublox or sparkfun directly without an forum ?

There might not be many folks who have used it that check the forums :-/

Yes, testing with an alternate broker was what I meant…that way you can hopefully at least rule that side of the equation out

No, there isn’t another contact method that I’m aware of, but hopefully someone will chime in

@TS-Russell
I found this here in the manual at page 382:

MQTT error +UMQTTER
29.5.1 Description
Retrieves the error class and code of the last MQTT operation that provided an error.
29.5.2 Syntax
Type Syntax Response Example
Action AT+UMQTTER +UMQTTER: <error_code1>,<error_
code2>
OK
AT+UMQTTER
+UMQTTER: 1,1
OK

i will test in the next days, if i can get some information about the error on this way

Hi Carl (@Carl_Hering ),

For the SARA-R5, it is important that you configure the module correctly: Register Operator, Configure Packet Switched Data (PSD), then attempt MQTT. If PSD is not configured correctly, if Ping fails, MQTT will not work.

This section of the Hookup Guide contains useful information, but it is written around our SARA-R5 Arduino Library, which is layered on top of the AT Commands.

Configuring PSD is described in a different hookup guide here. The essential commands are:

  • AT+UPSD=0,100,1
    • This instructs the SARA to map the Context ID 1 profile into Profile ID 0.
  • AT+UPSD=0,0,2
    • This instructs the SARA to use the “IPv4v6 with IPv4 preferred” protocol for Profile ID 0 (this needs to match the operator’s protocol).
  • AT+UPSDA=0,3
    • This instructs the SARA to activate Profile ID 0.
  • AT+UPING=“www.google.com”
    • This instructs the SARA to ping the Google server

Again, if Ping does not work, MQTT will not work.

We do have a ThingSpeak MQTT example, but it uses the Arduino Library. You would need to go down a layer to see what AT commands are being sent.

The MQTT errors are defined in the SARA-R5 AT Command Reference, hidden away in Appendix A.8.4. <error_code1> (section A.8) will be 13 for a MQTT error, <error_code2> (section A.8.4.1) will be 34 for “No Network Service” etc..

I hope this helps,
Paul

1 Like

Hello @PaulZC
Thank you for all this informations. I will test it in the next week and give you feedback.

1 Like

Hi @PaulZC ,
i looked inside the documentation and the arduino code and the PSD commands.

With exactly your command it works now:

* AT+UPSD=0,100,1
  * This instructs the SARA to map the Context ID 1 profile into Profile ID 0.
* AT+UPSD=0,0,2
  * This instructs the SARA to use the “IPv4v6 with IPv4 preferred” protocol for Profile ID 0 (this needs to match the operator’s protocol).
* AT+UPSDA=0,3
  * This instructs the SARA to activate Profile ID 0.
* AT+UPING=“[www.google.com](http://www.google.com/)”
  * This instructs the SARA to ping the Google server

And i used the ublox mcenter

Thank you so mutch ! :partying_face:

1 Like

Thanks for the update Carl (@Carl_Hering ) - glad it’s working for you,
Paul