SARA SFF R412 Mqtt test R4xx library

Hello,

I just tried to run the project “mqtt_test” of the library SODAQ_R4X on board SARA SFF R412 LTE-M but it does not work.

The network connection is working properly “Network connected” but I have this error :

AT+UMQTT=2,“test.mosquitto.org”,1883
<<
<< +UMQTT: 2,1
<< OK

AT+UMQTTC=1
<< timed out
MQTT failed
Setup done

Do you know where the problem may come from?

Hi @Pogprop,

Do you have a battery connected?
A USB doesn’t provide enough power to connect to a network.

Best regards,
Jan

Yes the battery is present.

After several tries, the MQTT works and connects. I do not know why, but sometimes you have to restart the program …

However, when a message is received, it does not appear :

Setup done
<<
<< +UUMQTTCM: 6,1
Unsolicited: MQTT pending messages:1

AT+UMQTTC=6
<<
<< +UMQTTC: 6,1
<< OK
<<
<< +UUMQTTCM: 6,1
Unsolicited: MQTT pending messages:1
Read messages:1
/home/test/test1

But the message never appears, is this normal?

Hi @Pogprop,

MQTT doesn’t work reliable on the R4XX module yet, we are in contact with ublox about solving the MQTT issues.

Best regards,
Jan

Hi,

Thank you for your response, keep me informed when the MQTT will work please.

Best regards.

1 Like

Was this issue ever resolved in newer firmware versions? I am having the same issue (FW, L0.0.00.00.05.08,A.02.01). Getting the topic rather than the message. I don’t get the AT commands debug output. How do I enable that?

Hi @themuli,

I recommend you updating the firmware version on the module.
The examples are tested against the latest version of the module.
Not all AT commands are backwards compatible. Setting the mno profile in the latest version is required.

In the .cpp file comment out DEBUG

Best regards,
Jan

Thanks. I updated to the latest firmware with the same result. Topic instead of message. I’ll try it with the debug enabled to see what data is coming through.

Does MQTT SN work reliably with the built-in ublox stack?

Hi @themuli,

You can try our library to setup an mqtt connection if you have issues with the reliably.
https://support.sodaq.com/Boards/Sara_AFF/faq/#mqtt-connection-not-stable

Best regards,
Jan

Hi @Jan,

Thanks.

I am still having trouble getting the mqtt_test example to read incoming messages. Debug does not provide more info with regards to the raw message coming in:

17:40:51.999 -> << 
17:40:52.036 -> << +UUMQTTCM: 6,1
17:40:52.036 -> Unsolicited: MQTT pending messages:1
17:40:52.036 -> Read messages:1
17:40:52.036 -> test

In this case ‘test’ is the topic name. Do you have a suggestion how to debug to see why the message is not displayed?

I also had a look at your MQTT library. Could you point me to examples using MQTT & TLS ?

themuli

@Jan
I don’t know if this is related but the sodaq_R4X_pub example works and the sodaq_R4X_sub example fails (with the same connection parameters):

18:28:56.785 -> << OK
18:28:57.102 -> >> AT
18:28:57.102 -> << +UUSOCL: 0
18:28:57.102 -> Unsolicited: Socket 0
18:28:57.102 -> << OK
18:28:57.102 -> subscribe failed

Hi @themuli,

I’m glad to hear the pub example works :slight_smile:
Can you provide some information so we can try to replicate the issue with the sub example?

  • R4XXM Firmware version
  • Versions of the libraries you used
  • Network operator
  • Used network settings
  • MQTT Server

Best regards,
Jan

Hi @Jan:

Here some details:

  • R4XXM Firmware version

    • SARA-R410M-02B-01-L0_0_00_00_05_08.dof
  • Versions of the libraries you used

    • Sodaq_R4X 2.0.2
    • Sodaq_R4X_MQTT 1.0.0
    • Sodaq_MQTT master
  • Network operator

    • KPN
  • Used network settings

    • #define APN “m2m.newlinemobile”
      #define URAT SODAQ_R4X_LTEM_URAT
      #define MNOPROF MNOProfiles::STANDARD_EUROPE
      #define OPERATOR AUTOMATIC_OPERATOR
      #define M1_BAND_MASK BAND_MASK_UNCHANGED
      #define NB1_BAND_MASK BAND_MASK_UNCHANGED
  • MQTT Server

    • Vernemq 1.10.1 on AWS
1 Like

@Jan have you been able to reproduce the problem. Any guidance how to get it to work?
I am currently communicating payload values in the topic in the prototype but for the finished product I need to get this to work.

Thanks for your help.

Hi @themuli,

I haven’t had so much time to investigate the issue.
What I have seen is that in the example there is an issue with connecting to the mosquitto server.
Although when using a custom server or the public hivemq, I don’t have any issues.

I hope that when I find the issue for the mosquitto problem that it will be the same for your AWS issue.

Best regards,
Jan

Hi @Jan.

SOLVED

I managed to solve it some time ago and I wanted to share the solution.
Maybe it was just my lack of understanding how char arrays and strings work. Both, topic and payload are in the buffer. The topic is terminated by a null byte and ‘print()’ stops after that. Splitting topic and payload into separate arrays solves the issue.

Regards,
Aike