Go Down

Topic: why SIM7600 MQTT return +CMQTTCONNECT: 0,6 ? (Read 676 times) previous topic - next topic

vietbac

Mar 09, 2020, 05:17 am Last Edit: Mar 11, 2020, 10:20 am by vietbac
Hi all,
I used the SIM7600CE and Arduino mega to send, receive message to MQTT.
My process to start MQTT in setup as
1. AT+CMQTTSTART
2. AT+CMQTTACCQ=0,"SIM7600_client"
3. AT+CMQTTCONNECT=0,\"tcp://tailor.cloudmqtt.com:11831\",90,1,\"xxxxxx\",\"yyyyyyyyy\""
4. AT+CMQTTSUBTOPIC
5. subscribe name
6. AT+CMQTTSUB

After that on loop, I send message to broker as process like this
1. AT+CMQTTTOPIC
2. Publish name
3. AT+CMQTTPAYLOAD
4. message
5. AT+CMQTTPUB

my problem is just broker can receive the first time.
if send more, SIM7600 return error 14, mean client busy, and after that return error 11, mean disconnect

Any people can help explain this problem ??

Thanks.
VB

pylon

Post the responses you get from the SIM7600 to the above commands!

vietbac

Hi pylon,

The SIM7600 return after send the AT+CMQTTCONNECT is

OK

+CMQTTCONNECT=0,6

I can't find any document talk about this error code.

Thanks.
VB

pylon

Quote
I can't find any document talk about this error code.
According to the manual:

Quote
6 - message receive fail.
Post your complete code and the complete output you get!

Did you try to disconnect (AT+CMQTTDISC) before you re-connect?

vietbac

Hi pylon,

yes, I have disconnect before re-connect, and just after turn on power or reset (AT+CRESET), the module also return same.

this is function for start

void startMQTTServer(){
   Serial2.println("Start MQTT server to broker >>");
   Serial2.println("send AT+ATE0 >>");
   sim7600.sendATcommand("ATE0", "OK", 1000);
   printResponceSIM();
   Serial2.println("send AT+CMQTTSTART >>");
   strcpy_P(str_buffer, (char *)pgm_read_word(&(cmd_table[11])));    //start network        
   sim7600.sendATcommand(str_buffer, "+CMQTTSTART: 0", 2000);
   printResponceSIM();
//    sim7600.sendATcommand("AT+CMQTTACCQ=0,\"SIM7600_client\"", "OK", 2000);
   Serial2.println("send AT+CMQTTACCQ >>");
   strcpy_P(str_buffer, (char *)pgm_read_word(&(cmd_table[21])));    //issue name of client
   sim7600.sendATcommand(str_buffer, "OK", 2000);
   printResponceSIM();
   Serial2.println("send AT+CMQTTWILLTOPIC >>");
   sim7600.sendATcommand("AT+CMQTTWILLTOPIC=0,10", ">", 2000);
   printResponceSIM();
   Serial2.println("send will topic >>");
   sim7600.sendATcommand("will topic", "OK", 2000);
   printResponceSIM();

   Serial2.println("send AT+CMQTTWILLMSG >>");
   sim7600.sendATcommand("AT+CMQTTWILLMSG=0,56,1", ">", 2000);
   printResponceSIM();
   Serial2.println("send will topic message >>");
   sim7600.sendATcommand("you'd better set will topic before setting will message.", "OK", 2000);
   printResponceSIM();
 
//    sim7600.sendATcommand(AT+CMQTTCONNECT=0,\"tcp://tailor.cloudmqtt.com:11831\",600,1,\"xxxxxxxx\",\"xxxxxxxxxxxx\"", "OK", 2000);
   Serial2.println("send AT+CMQTTCONNECT >>");
   strcpy_P(str_buffer, (char *)pgm_read_word(&(cmd_table[20])));    //connect MQTT broker
   result = sim7600.sendATcommand(str_buffer, "+CMQTTCONNECT: 0,0", 180000);
   if(result){
       connectFlag=true;      //connect server OK
       Serial2.println("Connect OK !");
   }else Serial2.println("Connect NG !");
   
   printResponceSIM();


}

and this is return from SIM7600

Start MQTT server to broker >>
send AT+ATE0 >>

OK
send AT+CMQTTSTART >>

OK

+CMQTTSTART: 0
send AT+CMQTTACCQ >>

OK
send AT+CMQTTWILLTOPIC >>

>
send will topic >>

OK
send AT+CMQTTWILLMSG >>

>
send will topic message >>

OK
send AT+CMQTTCONNECT >>
Connect NG !

OK

+CMQTTCONNECT: 0,6

Start send SUBTOPIC to broker >>
send AT+CMQTTSUBTOPIC >>

+CMQTTSUBTOPIC: 0,11

ERROR

pylon

This is not your complete code and you also forgot the code tags!

meroata

Can you please share the complete code because I need it

juhan5025

Hi, vietbac
did you resolve this?
I've been getting same issue,, so could you share how to fix this?


rykers

Sorry for bumping an old thread here, but I believe I am having this same issue.

I have detailed my problem here: https://forum.arduino.cc/index.php?topic=697539.0

Have spent weeks trying to fix this, even contacted SIMCOM support and attempted to contact one of their engineers... No response.

Did you manage to solve this issue? If so please share you fix with us.

Go Up