google-cloud-platformmqttgoogle-cloud-iotquectel

There is a problem to connect GCP IoT core with BG96


Before, I succeed to connect AWS IoT Core with BG96(LTE module).

And now I'm trying to connect GCP IoT Core with BG96. However, there are some problems.

I followed the guideline of IoT Core and downloaded MQTT server certificates(complete Goolge root CA, RSA key with a self-signed x.509 certificate).

Then, created JWT from jwt.io using another generated RSA key with below header and payload.

enter image description here

After, uploaded key files to cert section of device tab.

enter image description here

At BG96, I set the configurations like below. (root : complete Google root CA, cert : rsa_cert.pem (x.509), key : rsa_private.pem (x.509))

AT+QCDS
+QCDS: "SRV","CAT-M",45012,2500,12BAF1B,R13,3,313,1031,-75,-102,-10,3,128,0,0,0
OK
AT+QSSLCFG="cacert",0,"UFS:root.pem"
OK
AT+QSSLCFG="clientcert",0,"UFS:cert.pem"
OK
AT+QSSLCFG="clientkey",0,"UFS:key.pem"
OK
AT+QSSLCFG="seclevel",0,2
OK
AT+QSSLCFG="sslversion",0,4
OK
AT+QMTCFG="SSL",0,1,0
OK
AT+QMTCFG="will",0,0
OK
AT+QMTCFG="version",0,4
OK
AT+QMTCFG="keepalive",0,60
OK
AT+QMTCFG="session",0,1
OK
AT+QMTOPEN=0,"mqtt.googleapis.com",8883
OK
+QMTOPEN: 0,0
AT+QMTCONN=0,"projects/mqtt-test/locations/asia-east1/registries/test-registry/devices/my-
device","unused",["jwt"](I just covered it up)
OK
+QMTSTAT: 0,1

I don't know why but It keeps disconnecting GCP.

Did I make a mistake somewhere?


Solution

  • I found the problem. The client ID was different. It was mqtt-test-282503, not mqtt-test.