MC660K-GL Problem with connect cmd

Good morning

I have a BC660K-GL module connects by uart directly with my pc.

I have read “BC660K-GL AT Commands Manual”, “BC660K-GL MQTT Application Note” and “BC660K-GL SSL Application Note”.

I´m following the example in the doc for mqtt and ssl, modifying with my info. All commands response OK but when I have the connection opended (code 0, “Network connection opened successfully”) and i try to connect with “at+qmtconn”, it closes the connect and I recieve “+QMTSTAT: 3,7”.

I have the last revision when ssl it was added:

Quectel_Ltd
Quectel_BC660K-GL
Revision: BC660KGLAAR01A04

The commands I´m sending:

Log:

[2022-05-18_12:13:46:507]
[2022-05-18_12:13:46:507]RDY
[2022-05-18_12:13:46:679]
[2022-05-18_12:13:46:679]+CFUN: 1
[2022-05-18_12:13:46:886]
[2022-05-18_12:13:46:886]+CPIN: READY

[2022-05-18_12:13:46:886]+CEREG: 2
[2022-05-18_12:13:52:959]
[2022-05-18_12:13:52:959]+IP: xxx.xx.xx

[2022-05-18_12:13:52:959]+CEREG: 5,“0A98”,“0169DD3F”,9
[2022-05-18_12:13:53:747]
[2022-05-18_12:13:53:747]OK
[2022-05-18_12:13:55:724]
[2022-05-18_12:13:55:724]OK
[2022-05-18_12:13:57:726]
[2022-05-18_12:13:57:726]OK
[2022-05-18_12:13:59:747]
[2022-05-18_12:13:59:747]OK
[2022-05-18_12:14:01:740]
[2022-05-18_12:14:01:740]>
[2022-05-18_12:14:04:221]
[2022-05-18_12:14:04:221]+QSSLCFG: 0,0,“cacert”,1274

[2022-05-18_12:14:04:251]OK
[2022-05-18_12:14:06:246]
[2022-05-18_12:14:06:246]>
[2022-05-18_12:14:08:757]
[2022-05-18_12:14:08:757]+QSSLCFG: 0,0,“clientkey”,1650

[2022-05-18_12:14:08:757]OK
[2022-05-18_12:14:10:747]
[2022-05-18_12:14:10:747]>
[2022-05-18_12:14:13:260]
[2022-05-18_12:14:13:260]+QSSLCFG: 0,0,“clientcert”,1190

[2022-05-18_12:14:13:260]OK
[2022-05-18_12:14:15:234]
[2022-05-18_12:14:15:234]OK
[2022-05-18_12:14:15:746]
[2022-05-18_12:14:15:746]OK
[2022-05-18_12:14:16:250]
[2022-05-18_12:14:16:250]OK
[2022-05-18_12:14:44:651]
[2022-05-18_12:14:44:651]OK
[2022-05-18_12:14:45:171]
[2022-05-18_12:14:45:171]+QMTOPEN: 3,0
[2022-05-18_12:14:52:621]
[2022-05-18_12:14:52:621]OK
[2022-05-18_12:14:53:515]
[2022-05-18_12:14:53:515]+QMTSTAT: 3,7
[2022-05-18_12:15:35:551]
[2022-05-18_12:15:35:551]+QSSLCFG: 0,0,“seclevel”,0
[2022-05-18_12:15:35:551]+QSSLCFG: 0,0,“sslversion”,4
[2022-05-18_12:15:35:551]+QSSLCFG: 0,0,“dataformat”,0,0
[2022-05-18_12:15:35:551]+QSSLCFG: 0,0,“timeout”,90
[2022-05-18_12:15:35:551]+QSSLCFG: 0,0,“debug”,0
[2022-05-18_12:15:35:551]+QSSLCFG: 0,0,“cacert”,1274
[2022-05-18_12:15:35:551]+QSSLCFG: 0,0,“clientcert”,1190
[2022-05-18_12:15:35:551]+QSSLCFG: 0,0,“clientkey”,1650
[2022-05-18_12:15:35:551]+QSSLCFG: 0,0,“dtls”,0
[2022-05-18_12:15:35:598]+QSSLCFG: 0,0,“dtlsversion”,2

[2022-05-18_12:15:35:598]OK

Any idea why this is happening? Thank you.

I recommend using MQtt. fx to test your server first
mqttfx-1.7.1-windows-x64.exe

Good morning @herbert.pan-Q.

I have try with “mqtt.fx” and I can connect/subscribe/Publish without problems.

But I have tried changing the configuration of the “SSL/TLS” section and I have seen that if I uncheck “Enable SSL/TLS”:
image

The application does not connect and the same error message appears in the broker logs as when I try to establish a connection with the quectel.

With quectel I have try establish the specific version of “SSL_version” (TLS 1.2) and set the authentication mode with (2 Perform server and client authentication if requested by the remote server):

[2022-05-20_12:28:47:360]+QSSLCFG: 0,0,“seclevel”,2
[2022-05-20_12:28:47:360]+QSSLCFG: 0,0,“sslversion”,3
[2022-05-20_12:28:47:360]+QSSLCFG: 0,0,“dataformat”,0,0
[2022-05-20_12:28:47:360]+QSSLCFG: 0,0,“timeout”,90
[2022-05-20_12:28:47:360]+QSSLCFG: 0,0,“debug”,0
[2022-05-20_12:28:47:360]+QSSLCFG: 0,0,“cacert”,1274
[2022-05-20_12:28:47:360]+QSSLCFG: 0,0,“clientcert”,1190
[2022-05-20_12:28:47:360]+QSSLCFG: 0,0,“clientkey”,1650
[2022-05-20_12:28:47:360]+QSSLCFG: 0,0,“dtls”,0
[2022-05-20_12:28:47:391]+QSSLCFG: 0,0,“dtlsversion”,2

But I still can´t establish a connect with broker.

I suggest you refer to this document, which may also be helpful
Quectel_BG95_Series_AWS_IoT_Platform_Access_User_Guide_V1.0_Preliminary_20200825.pdf (1.4 MB)

Good morning @herbert.pan-Q .

I have seen the document but I´m some confused because this is for BG95 series. When you say “helpful”, do you refer the way to load certificates with QFUPL cmd?

Good morning @herbert.pan-Q .

I have corrected some cmd (“AT+QSSLCFG” and “AT+QMTCFG”) to have the same “SSL_contextID, SSL_connectID, contextID, connectID” and I have added others parameters like “keepalive”, “will”.

At this moment, I have other problem, I have three certificates, but it only works if I send them using “Select File” and “Send File” options, if I send them like a string it doesn´t work.

Is there some different bettween “Send File” and send certificate like a string with “AT+QSSLCFG=0,0,“cacert”” cmd?

Example, I have this certificate:

-----BEGIN CERTIFICATE-----
aaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbb
ccccccccccccccccccccccccccccc
dddddddddddddddddddddddddd
-----END CERTIFICATE-----

If I need to send it like a string, how should I do it, with “\n”, “\n\r”?

-----BEGIN CERTIFICATE-----\naaaaaaaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbbbbbbbbb\nccccccccccccccccccccccccccccc\ndddddddddddddddddddddddddd\n-----END CERTIFICATE-----

Thank for help.

I suggest you upload the certificate as a file, string format is also allowed, but I cannot verify it

At this moment I can upload as a file because I have an uart directly with quectel but later I will have a microcontroller who will send the commands, certificates, etc. For this reason i need other way to send certificates from a microcontroller like a string.

I suggest you test this by adding a “\n\r”