Xinyuan-LilyGO / LilyGO-T-A76XX

LilyGo A7670X A7608X SIM7670G series
MIT License
128 stars 57 forks source link

MqttsBuiltlnHivemq.ino example code fails on T-7670G after firmware update #183

Open 0xMattijs opened 4 days ago

0xMattijs commented 4 days ago

In order to solve a problem with SNI when using HTTPS I upgraded the firmware for my T-7670G to version B04:

AT+SIMCOMATI
Manufacturer: SIMCOM INCORPORATED
Model: SIM7670G-MNGV
Revision: 2374B04SIM767XM5A_M
SIM767XM5_B04V01_241010
IMEI: XXXXXXXXXX

This fixed the problem for HTTPS, but now MQTT communication with SSL fails. This problem can be reproduced using the MqttsBuiltlnHivemq.ino example.

The connect after the modem.mqtt_set_certificate(HivemqRootCA); call results in the AT+CCERTDOWN command failing:

AT+CMQTTSTART
OK

+CMQTTSTART: 0

AT+CCERTDOWN="ca_cert.pem",5555
>
-----BEGIN CERTIFICATE-----
MIIFBzCCA++gAwIBAgISA3nTO8URQRBuVpc/TcIA/pSpMA0GCSqGSIb3DQEBCwUA
MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD
EwJSMzAeFw0yMzEwMDQyMzE3NTNaFw0yNDAxMDIyMzE3NTJaMB8xHTAbBgNVBAMM
FCouczIuZXUuaGl2ZW1xLmNsb3VkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
CgKCAQEAxKOySSNPeWJ6cIWbmm1Psc3VmL/YK+K5NZj2GlOJJaMKopb6y0A8V7wy
YM0kaiIe4fGfdLxSKwoFrSXe8gsmaOkgdU734OweOGCPaU3W0ZjIqZzRzhpT8FY9
zj8NlpZpV/QGbbmYCOy6YfAixpZ10L9L1g74CO9M6Guf706Dfg9E1O4N5IwWQr1i
Yv1hvdr1tTHlblj0DcFVu+nYaJ0RIPsiHt3lfldphXGuw1pIEpuv61D121furZqQ
D3onWw1oQ3eUhJYUI/nKqrNSyrYDzvYckdzOnnit/lCuJqAzmFdYvEmyHvmWwS7H
GOEYK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NVHSAETTBLMAgGBmeBDAECATA/BgsrBgEEAYLfEwEB
ATAwMC4GCCsGAQUFBwIBFiJodHRwOi8vY3BzLnJvb3QteDEubGV0c2VuY3J5cHQu
b3JnMDwGA1UdHwQ1MDMwMaAvoC2GK2h0dHA6Ly9jcmwuaWRlbnRydXN0LmNvbS9E
U1RST09UQ0FYM0NSTC5jcmwwHQYDVR0OBBYEFHm0WeZ7tuXkAXOACIjIGlj26Ztu
MA0GCSqGSIb3DQEBCwUAA4IBAQAKcwBslm7/DlLQrt2M51oGrS+o44+/yQoDFVDC
5WxCu2+b9LRPwkSICHXM6webFGJueN7sJ7o5XPWioW5WlHAQU7G75K/QosMrAdSW
9MUgNTP52GE24HGNtLi1qoJFlcDyqSMo59ahy2cI2qBDLKobkx/J3vWraV0T9VuG
WCLKTVXkcGdtwlfFRjlBz4pYg1htmf5X6DYO8A4jqv2Il9DjXA6USbW1FzXSLr9O
he8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFC
Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
-----END CERTIFICATE-----

ERROR
[ 14226][E][TinyGsmMqttA76xx.h:107] mqtt_connect(): [A76XX] Write ca_cert pem failed!
Failed!
0xMattijs commented 4 days ago

I tried downgrading to B03, with the same result. Is it possible that the partition meant for storing the certificates is missing in the firmware package?

lewisxhe commented 4 days ago

OK, I also encountered the same error, I need SIMCOM to provide a solution to the problem. I will update here if there is any update

lewisxhe commented 4 days ago

All versions after B02 have issues. I have submitted the log to SIMCOM for analysis.

2374B03STM767XM5A_M

image

2374B02SIM767XM5A_M

image

0xMattijs commented 4 days ago

Is there a download link for the B02 version, so at least I can restore the MQTT feature?

lewisxhe commented 4 days ago

@0xMattijs https://drive.google.com/file/d/1-63xiw4TbGwHi3rQDzJpPKwp2SDNPXC1/view