I have problems connecting EC25-EUX to mosquitto broker

Hello!

I am trying to create a project where I connect my EC25-EUX modem (I have the modem attached to the MINI PCIe EVB kit) to a mosquitto broker and publish data in a specific topic. I am new to these kind of projects and I am having problems to carry it out.

I have been following different documents where the example’s steps are explained (https://sixfab.com/wp-content/uploads/2020/08/Quectel_EC2xEG9xEM05_MQTT_Application_Note_V1.1.pdf) but when I reach the step of connecting to a MQTT server I always receive an error.

Before I begin with the steps of the application note I configure the TCP/IP communication of the modem.

The steps I follow are:

  1. Connect my evaluation board to QNavigator and connect the module (it does an automatic initialization). I connect the board to Quectel USB AT Port.
  2. Configure a Context:
    AT+QICSGP=1,1,“(myAPN)”,“”,“”,0
    → OK
  3. Activate the context:
    AT+QIACT=1
    → OK
  4. Make sure the context I have configured is open:
    AT+QIACT?
    → 1,1,1,“10.64.75.67”
  5. Open a socket in buffer mode:
    AT+QIOPEN=1,0,“TCP”,“137.135.82.217”,1883,0,0
    → OK

NOTE: to know the mosquitto broker’s IP I do ping to the host mqtt.eclipseprojects.io and I can see the server’s IP.

  1. Configure MQTT receiving mode:
    AT+QMTCFG=“recv/mode”,0,0,1
    → OK
  2. Open a network for MQTT client:
    AT+QMTOPEN=0,“137.135.82.217”,1883
    → OK
    → 0,-1 (Error code: Failed to open network)

I have tried opening also with the url instead of the IP (mqtt.eclipseprojects. io) but I get the same URC message.

If someone can please help me, I have tried all the possible examples but I never get to connect to the mosquitto broker. Thank you!

I’ll leave the first automatic initialization here if it’s useful:

/* Start AT SYNC: Send AT every 500ms, if receive OK, SYNC success, if no OK return after sending AT 10 times, SYNC fail */
[2023-10-30 08:53:45:419_S:] AT
[2023-10-30 08:53:45:486_R:] AT
[2023-10-30 08:53:45:486_R:] OK
[2023-10-30 08:53:45:488_S:] ATI
[2023-10-30 08:53:45:551_R:] ATI
[2023-10-30 08:53:45:551_R:] Quectel
[2023-10-30 08:53:45:551_R:] EC25
[2023-10-30 08:53:45:551_R:] Revision: EC25EUXGAR08A09M1G

[2023-10-30 08:53:45:551_R:] OK
[2023-10-30 08:53:45:569_S:] ATI
[2023-10-30 08:53:45:635_R:] ATI
[2023-10-30 08:53:45:635_R:] Quectel
[2023-10-30 08:53:45:635_R:] EC25
[2023-10-30 08:53:45:635_R:] Revision: EC25EUXGAR08A09M1G

[2023-10-30 08:53:45:635_R:] OK

/* Use ATV1 to set the response format */
[2023-10-30 08:53:45:654_S:] ATV1
[2023-10-30 08:53:45:719_R:] ATV1
[2023-10-30 08:53:45:719_R:] OK

/* Use ATE1 to enable echo mode */
[2023-10-30 08:53:45:969_S:] ATE1
[2023-10-30 08:53:46:034_R:] ATE1
[2023-10-30 08:53:46:034_R:] OK

/* Use AT+CMEE=2 to enable result code and use verbose values */
[2023-10-30 08:53:46:187_S:] AT+CMEE=2
[2023-10-30 08:53:46:253_R:] AT+CMEE=2
[2023-10-30 08:53:46:253_R:] OK

/* Get the baudrate, if the value is 0 (auto baudrate), then it will be set to 115200 (fixed baudrate) to assure reliable communication and avoid any problems caused by undetermined baudrate between DCE and DTE, value of IPR should be saved with AT&W */
[2023-10-30 08:53:46:515_S:] AT+IPR?
[2023-10-30 08:53:46:569_R:] AT+IPR?
[2023-10-30 08:53:46:569_R:] +IPR: 115200

[2023-10-30 08:53:46:569_R:] OK

/* Use ATI to get module information of Manufacturer ID, Device module and Firmware version */
[2023-10-30 08:53:46:635_S:] ATI
[2023-10-30 08:53:46:701_R:] ATI
[2023-10-30 08:53:46:701_R:] Quectel
[2023-10-30 08:53:46:701_R:] EC25
[2023-10-30 08:53:46:701_R:] Revision: EC25EUXGAR08A09M1G

[2023-10-30 08:53:46:701_R:] OK

/* Use AT+GSN to query the IMEI of module */
[2023-10-30 08:53:46:818_S:] AT+GSN
[2023-10-30 08:53:46:873_R:] AT+GSN
[2023-10-30 08:53:46:873_R:] 862506047432318

[2023-10-30 08:53:46:873_R:] OK
[2023-10-30 08:53:46:875_S:] AT+QURCCFG=“URCPORT”,“usbmodem”
[2023-10-30 08:53:46:933_R:] AT+QURCCFG=“URCPORT”,“usbmodem”
[2023-10-30 08:53:46:933_R:] OK

/* Use AT+CPIN? to query the SIM card status : SIM card inserted or not, locked or unlocked */
[2023-10-30 08:53:47:478_S:] AT+CPIN?
[2023-10-30 08:53:47:543_R:] AT+CPIN?
[2023-10-30 08:53:47:543_R:] +CPIN: READY

[2023-10-30 08:53:47:543_R:] OK

/* Use AT+CIMI to query the IMSI of SIM card */
[2023-10-30 08:53:47:672_S:] AT+CIMI
[2023-10-30 08:53:47:729_R:] AT+CIMI
[2023-10-30 08:53:47:729_R:] 204043253335437

[2023-10-30 08:53:47:729_R:] OK

/* Use AT+QCCID to query ICCID number of SIM card */
[2023-10-30 08:53:47:905_S:] AT+QCCID
[2023-10-30 08:53:47:968_R:] AT+QCCID
[2023-10-30 08:53:47:968_R:] +QCCID: 89314404000106191548

[2023-10-30 08:53:47:968_R:] OK

/* Use AT+CSQ to query current signal quality */
[2023-10-30 08:53:48:023_S:] AT+CSQ
[2023-10-30 08:53:48:084_R:] AT+CSQ
[2023-10-30 08:53:48:084_R:] +CSQ: 23,99

[2023-10-30 08:53:48:084_R:] OK

/* Use AT+CREG? /AT+CGREG? to query the network registration status. */
[2023-10-30 08:53:48:093_S:] AT+CREG?
[2023-10-30 08:53:48:151_R:] AT+CREG?
[2023-10-30 08:53:48:151_R:] +CREG: 0,5

[2023-10-30 08:53:48:151_R:] OK
[2023-10-30 08:53:48:174_S:] AT+CGREG?
[2023-10-30 08:53:48:234_R:] AT+CGREG?
[2023-10-30 08:53:48:234_R:] +CGREG: 0,5

[2023-10-30 08:53:48:234_R:] OK

/* Use AT+COPS? to query current Network Operator */
[2023-10-30 08:53:48:281_S:] AT+COPS?
[2023-10-30 08:53:48:336_R:] AT+COPS?
[2023-10-30 08:53:48:336_R:] +COPS: 0,0,“vodafone ES DATA ONLY”,7

[2023-10-30 08:53:48:336_R:] OK

/Use AT+CEREG? to query current EPS Network Registration Status/
[2023-10-30 08:53:48:394_S:] AT+CEREG?
[2023-10-30 08:53:48:465_R:] AT+CEREG?
[2023-10-30 08:53:48:465_R:] +CEREG: 0,5

[2023-10-30 08:53:48:465_R:] OK
[2023-10-30 08:53:48:501_S:] AT+CLVL=?
[2023-10-30 08:53:48:576_R:] AT+CLVL=?
[2023-10-30 08:53:48:576_R:] +CLVL: (0-5)

[2023-10-30 08:53:48:576_R:] OK
[2023-10-30 08:57:51:262_S:] AT+QICSGP=1
[2023-10-30 08:57:51:340_R:] AT+QICSGP=1
[2023-10-30 08:57:51:340_R:] +QICSGP: 1,“orom2m.vf.es”,“”,“”,0

[2023-10-30 08:57:51:340_R:] OK
[2023-10-30 09:00:39:699_S:] AT+QICSGP=1

/* Start AT SYNC: Send AT every 500ms, if receive OK, SYNC success, if no OK return after sending AT 10 times, SYNC fail */
[2023-10-30 09:01:21:009_S:] AT
[2023-10-30 09:01:21:078_R:] AT
[2023-10-30 09:01:21:078_R:] OK
[2023-10-30 09:01:21:084_S:] ATI
[2023-10-30 09:01:21:162_R:] ATI
[2023-10-30 09:01:21:162_R:] Quectel
[2023-10-30 09:01:21:162_R:] EC25
[2023-10-30 09:01:21:162_R:] Revision: EC25EUXGAR08A09M1G

[2023-10-30 09:01:21:162_R:] OK
[2023-10-30 09:01:21:178_S:] ATI
[2023-10-30 09:01:21:240_R:] ATI
[2023-10-30 09:01:21:240_R:] Quectel
[2023-10-30 09:01:21:240_R:] EC25
[2023-10-30 09:01:21:240_R:] Revision: EC25EUXGAR08A09M1G

[2023-10-30 09:01:21:240_R:] OK

/* Use ATV1 to set the response format */
[2023-10-30 09:01:21:262_S:] ATV1
[2023-10-30 09:01:21:325_R:] ATV1
[2023-10-30 09:01:21:325_R:] OK

/* Use ATE1 to enable echo mode */
[2023-10-30 09:01:21:579_S:] ATE1
[2023-10-30 09:01:21:641_R:] ATE1
[2023-10-30 09:01:21:641_R:] OK

/* Use AT+CMEE=2 to enable result code and use verbose values */
[2023-10-30 09:01:21:795_S:] AT+CMEE=2
[2023-10-30 09:01:21:864_R:] AT+CMEE=2
[2023-10-30 09:01:21:864_R:] OK

/* Get the baudrate, if the value is 0 (auto baudrate), then it will be set to 115200 (fixed baudrate) to assure reliable communication and avoid any problems caused by undetermined baudrate between DCE and DTE, value of IPR should be saved with AT&W */
[2023-10-30 09:01:22:111_S:] AT+IPR?
[2023-10-30 09:01:22:180_R:] AT+IPR?
[2023-10-30 09:01:22:180_R:] +IPR: 115200

[2023-10-30 09:01:22:180_R:] OK

/* Use ATI to get module information of Manufacturer ID, Device module and Firmware version */
[2023-10-30 09:01:22:227_S:] ATI
[2023-10-30 09:01:22:311_R:] ATI
[2023-10-30 09:01:22:311_R:] Quectel
[2023-10-30 09:01:22:311_R:] EC25
[2023-10-30 09:01:22:311_R:] Revision: EC25EUXGAR08A09M1G

[2023-10-30 09:01:22:311_R:] OK

/* Use AT+GSN to query the IMEI of module */
[2023-10-30 09:01:22:427_S:] AT+GSN
[2023-10-30 09:01:22:499_R:] AT+GSN
[2023-10-30 09:01:22:499_R:] 862506047432318

[2023-10-30 09:01:22:499_R:] OK
[2023-10-30 09:01:22:499_S:] AT+QURCCFG=“URCPORT”,“usbat”
[2023-10-30 09:01:22:565_R:] AT+QURCCFG=“URCPORT”,“usbat”
[2023-10-30 09:01:22:565_R:] OK

/* Use AT+CPIN? to query the SIM card status : SIM card inserted or not, locked or unlocked */
[2023-10-30 09:01:23:087_S:] AT+CPIN?
[2023-10-30 09:01:23:149_R:] AT+CPIN?
[2023-10-30 09:01:23:149_R:] +CPIN: READY

[2023-10-30 09:01:23:149_R:] OK

/* Use AT+CIMI to query the IMSI of SIM card */
[2023-10-30 09:01:23:281_S:] AT+CIMI
[2023-10-30 09:01:23:350_R:] AT+CIMI
[2023-10-30 09:01:23:350_R:] 204043253335437

[2023-10-30 09:01:23:350_R:] OK

/* Use AT+QCCID to query ICCID number of SIM card */
[2023-10-30 09:01:23:512_S:] AT+QCCID
[2023-10-30 09:01:23:581_R:] AT+QCCID
[2023-10-30 09:01:23:581_R:] +QCCID: 89314404000106191548

[2023-10-30 09:01:23:581_R:] OK

/* Use AT+CSQ to query current signal quality */
[2023-10-30 09:01:23:632_S:] AT+CSQ
[2023-10-30 09:01:23:697_R:] AT+CSQ
[2023-10-30 09:01:23:697_R:] +CSQ: 23,99

[2023-10-30 09:01:23:697_R:] OK

/* Use AT+CREG? /AT+CGREG? to query the network registration status. */
[2023-10-30 09:01:23:697_S:] AT+CREG?
[2023-10-30 09:01:23:766_R:] AT+CREG?
[2023-10-30 09:01:23:766_R:] +CREG: 0,5

[2023-10-30 09:01:23:766_R:] OK
[2023-10-30 09:01:23:781_S:] AT+CGREG?
[2023-10-30 09:01:23:844_R:] AT+CGREG?
[2023-10-30 09:01:23:844_R:] +CGREG: 0,5

[2023-10-30 09:01:23:844_R:] OK

/* Use AT+COPS? to query current Network Operator */
[2023-10-30 09:01:23:897_S:] AT+COPS?
[2023-10-30 09:01:23:966_R:] AT+COPS?
[2023-10-30 09:01:23:966_R:] +COPS: 0,0,“vodafone ES DATA ONLY”,7

[2023-10-30 09:01:23:966_R:] OK

/Use AT+CEREG? to query current EPS Network Registration Status/
[2023-10-30 09:01:24:012_S:] AT+CEREG?
[2023-10-30 09:01:24:081_R:] AT+CEREG?
[2023-10-30 09:01:24:081_R:] +CEREG: 0,5

[2023-10-30 09:01:24:081_R:] OK

Hi @aag
The ports used by TCP\ICMP\MQTT are generally different. The connection may fail because the port of the MQTT server is incorrect. You can use the domain name + port of the MQTT server to connect directly and try. If it still doesn’t work, clear the following configuration and try again.
AT+QSSLCFG=“sni”,1,1
Turn on the server name indication function of the SSL context AT+QSSLCFG=“ignoremulticertchainverify”,1,1
Configuring an SSL context to ignore multi-level certificate chain verification
AT+QSSLCFG=“ignorelocaltime”,1,1
Configure whether the SSL context ignores certificate validity verification

Hello @lyman-Q
First of all, thank you for answering! I appreciate it.
I don’t quite understand the solution you have talked about.

You have quoted 2 solutions: The first, do you mean to use domain name+port (mqtt.eclipseprojects.io:1883 ??) when I reach the last step mentioned in the issue (after having done the previous configuration)?

Se second solution: do I use the commands you have adviced before using the configuration commands I am using, or is it important to write the commands in an especific order?

Thank you for your time!

Hi @aag
What I mean is that the MQTT server cannot be opened because the port number is incorrect. Can you confirm whether this method can be connected normally on other devices? This can initially determine whether the connection cannot be caused by port or URL problems.

Hi @lyman-Q
I am using MQTT Explorer to create a new MQTT server. I haven’t been able to try to connect to this server with another device, but I have confirmed that the server works fine, because I have tried connecting to the server from another laptop and the MQTT messages are sent correctly.

I assume the port I have to configure is 1883, right?

Thank you!

Hi @aag
Can you use the QWINLOG tool to capture the problem log? First start recording the log, then AT+CFUN=0, AT+CFUN=1. After successfully connecting to the network, start connecting to the MQTT server until the connection fails. Finally, end the log recording and save the log. Send it to me and I’ll take a look.