Connecting M66 to google iot

Hi,

I’m trying to connect to google iot. I get +CME ERROR: invalid parameter while executing AT+QMTCONN
Just using ca root pem file. The client and server certificates are optional.
It is working fine from a python client (in pc). Pasted the logs below.
AT+QMTCONN command is 280 bytes. Is there any size limit?

Quectel_Ltd
Quectel_M66
Revision: M66FAR02A06BT

+CTZU: 1
OK
+QNITZ: 1
OK
+CTZU: 1
OK

gprs not connected
<-- URC_CFUN_STATE_IND -->
gsm connected
10/5/2021 12:49:11 TZ:22
gprs connected
PDP context open
AT+QSECWRITE=“RAM:cacert.pem”,676,200
CONNECT

+QSECWRITE: 676,197c

OK
AT+QSSLCFG=“cacert”,2,“RAM:cacert.pem”
OK
AT+QSSLCFG=“seclevel”,2,2
OK
AT+QSSLCFG=“sslversion”,2,4
OK
AT+QSSLCFG=“ciphersuite”,2,“0xFFFF”
OK
AT+QSSLCFG=“ignorertctime”,1
OK
AT+QMTCFG=“SSL”,0,1,2
OK
AT+QMTOPEN=0,“mqtt.2030.ltsapis.goog”,“8883”
OK
AT+QMTCONN=0,“projects/prj_id/locations/us-central1/registries/my_reg/devices/dv1”,“nu”,“eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJpYXQiOjE2MjA2NTA4MjYsImV4cCI6MTYyMDY1NDQyNiwiYXVkIjoiY2Ntc3FlIn0.yEUQLtFVkAP-TnQnPtJ5P66zsTsJcHr8SpkEamdNjIkrTvAXjjRvBFHC3Pp8Tsxii11G4MnSg9gRWb9x8OMz-Q”
+CME ERROR: invalid parameter (code: 3518)

Thanks

Hi,prakash:

AT+QMTOPEN=0,“mqtt.2030.ltsapis.goog”,“8883”

The port in the above command does not need to be in double quotes, and is the “goog” in your hostname correct?It is reguested that you use the MQTT.fx tool to test whether the MQTT server you are applying for is working properly before using the command to connect to the MQTT server.


I hope the suggestions above help you solve your problems!

Hi herbert, Thanks for your response.

Yes, the domain is correct.
I removed the double quote for port, still issue is not resolved.
In the document GSM_MQTT_Application_Note_V1.2, page #25, the port number is given in quotes. So I followed the same.
In order to connect to google iot, we need to generate a jwt token during runtime and provide it as password. So it wont work with MQTT.fx client.
I’m able to connect successfully and publish data using a python client using the same credentials that I used in M66. (https://github.com/googlecodelabs/iotcore-heartrate)
The following is the command I used to run the python client:
python heartrateSimulator.py --project_id=prj_id --registry_id=my_reg --device_id=dv1 --private_key_file=ec_private.pem --ca_certs=gtsltsr.pem --mqtt_bridge_hostname=mqtt.2030.ltsapis.goog --mqtt_bridge_port=8883

Thanks

hi,prakash:

+CME ERROR: invalid parameter (code: 3518)

We do not have the error code (3518) you provided in our technical documents, so we cannot provide the corresponding reason for the error. We suggest that you can try to change other MQTT servers. Through the above connection establishment process, we can see that there is no abnormal problem with your module, mainly because of the relevant configuration of MQTT servers.

Hi herbert,

Sure, I’ll try other serves and update you.
+CME ERROR: invalid parameter (code: 3518) can be found in page #238 in the document Quectel_M66_Series_AT_Commands_Manual_V2.1
Please let me know whether there is any upper limit for the length of AT Commands in M66.

Thanks

Hi,prakash:
Sorry, I did not find any indication of the length limit in the MQTT documentation for M66 and other types of modules.

Hi herbert,

I tried with broker.hivemq.com:1883 with out ssl. This also did not work. But broker.hivemq.com works in MQTT.fx client. Username, password is not needed. Please find logs below:

gprs connected
PDP context open
AT+QMTOPEN=?
+QMTOPEN: (0-5),"<host_name>",
AT+QMTOPEN=0,“broker.hivemq.com”,1883
OK
AT+QMTOPEN?
OK
AT+QMTCONN=?
+QMTCONN: (0-5),""[,""[,""]]

OK
AT+QMTCONN=0,“m66”
+CME ERROR: invalid parameter

Please wait for this URC to appear before executing AT+QMTCONN:


Then check the result is “0” or not,If is 0,you can excute AT+QMTCONN:
image

Hi Winnie, Thanks a lot.
You’re right. After waiting for URC +QMTCONN, I’m able to publish data to broker.hivemq.com successfully. I’m yet to check google iot. Will keep you guys posted.

Hi Prakash:
I’m glad to hear that your issue has been solved. Wish you all the best.