BC66 - MQTT - Failed to send packet (QMTSTAT)

I want to connect a BC66 with MQTT protocol with a Raspberry Pi which has a broker, publisher and subscriber.

At the moment, I already connected my BC66 module to the operator, where I receive somelhin like:

+IP: xxxx.xxx.xx.xx

After that, I simply do the following steps:

[Step 1] Open a network for MQTT client:

AT+QMTOPEN=0,“xxx.xx.xxx.xx”,1883

OK
+QMTOPEN: 0,0
+QMTSTAT: 0,1

[Step 2] Connect the client to MQTT server:

AT+QMTCONN=0,“client_BC66”

+QMTCONN: 0,2 // Failed to send packet
+QMTSTAT: 0,3 // Sending CONNECT packet timed out or failed

I already followed the steps in “How to do” about this error (+QMTSTAT: 0,3)

Shoul I increase the timeout due to maybe a low signa quality?

AT+CSQ
+CSQ: 2,0

AT+CESQ
+CESQ: 1,7,255,255,2,13

I do not know If i need to configure secure connection, but at the moment i just want to establish the connection between BC66 and RPI.

Otherwise, it is sugested to configure the some parameters using AT+QMTCFG Configure Optional Parameters of MQTT but I use the default ones.

Hi Miguel_Amado

AT + QMTOPEN = 0, “xxx.xx.xxx.xx”, 1883, after that, you need to initiate AT + QMTCONN = 0, “client_BC66” immediately.
You can provide your complete AT process and attach the execution time.

Here are the main sequence of AT commands that I used:

(The following commnads where created basen on this site)

AT+QSCLK=0 \ Disable Sleep Mode
ATE1 \ Enable echo to console
AT+QBAND=0 \ Set all mobile operation band
AT+QCGDEFCONT=“IP”,“abcdefgh” \ Setup the default APN
AT+COPS=1,2,“xxxxx” \ Configure operator manually
AT+QRST=1 \ Restart device
AT+QSCLK=0 \ Disable Sleep Mode
ATE1 \ Enable echo to console
+IP: xxx.xxx.xxx.xxx \ Wait 5-45 min. for the IP adress assigned

(The following commnads where created basen on “Examples”-“Use Normal TCP Connection for MQTT” in BC66&BC66-NA MQTT Application Note v2.0)

AT+QMTOPEN=0,“xxx.xx.xxx.xx”,1883 \ Open Network for MQTT client
AT+QMTCONN=0,“client_BC66” \ Connect the client to MQTT server
AT+QMTSUB=0,1,“topic/testBC66”,2 \ Subscribe to the topic (QoS=exactly once)
AT+QMTUNS=0,2,“topic/testBC66” \ Unsubscribe from the topic
AT+QMTPUB=0,0,0,0,“topic/testBC66”,“hello” \ Publish the message
AT+QMTDISC=0 \ Disconnect the client from MQTT server

In order to try to solve the problem mentionated in this topic (“Failed to send packet”), I changed the default configurations. After that changes, my module BC66 keeps trying to connect to network (wait for “+IP” message). Some of this changes was the following (Note: I dont want to use sleep modes at the moment):

[Part 1:] Config working mode:

AT+CEREG=5 //EPS Network Registration Status
AT+CGATT=1 //PS Attachment or Detachment
AT+CSCON=1 //[?] URC Enable or Disable
AT+CGACT= // [NO] Connect/Disc existing PDP (automatically activated cid 1)
AT+CGDCONT= //[?] Add new APNs?
AT+CIPCA=3,0 //[?] EPS with(out) PDN
AT+QCGDEFCONT=“IP”,“internetm2m” // Default PSD
AT+QGACT= //[?] Activation/Deactivation
AT+CEDRXS=0 //Disable E-UTRAN eDRX if no Power Consumption Requirements
AT+CFUN=1 // RF full available (extra: could be saved in NVRAM)
AT+CPSMS=0 // Disable PSM (saved in NVRAM)
AT+QEDRXCFG=0 // Disable eDRX (saved in NVRAM) (CONTRADITORIO COM CEREG)
AT+QSCLK=0 // Disable Sleep Modes ()
AT+QCFG=… //Use default values?

[Part 2] Configure MQTT Parameters:

AT+QMTCFG=“will”,0,1,0,0,“topic_will”,“will_msg”
AT+QMTCFG=“session”,0,1
AT+QMTCFG=“keepalive”,0,0
AT+QMTCFG=“aliauth”,0
AT+QMTCFG=“version”,0,3
AT+QMTCFG=“ssl”,0,0

I think I did some wrong configuration which dont allow the moddule connects to the network. So, I tryed to re-flash the module with the same Firmware version in order to remove all configurations sabed in NVRAM and returns to the default ones… I have no success, the configurations kept in NVRAM.

About your suggestion “you need to initiate AT + QMTCONN = 0, “client_BC66” immediately.”, I already did that, with a delay lower than 3 seconds and It gave error when I send "AT+QMTCONN=0,“client_BC66” ". I needed to waif for a connection confirmation and then I sent "AT+QMTCONN=0,“client_BC66” ".