HTTPS using LTE/4G on M5Stack Fire
-
Hi folks,
I've an M5Stack Fire and the LTE/4G module, and have spent dozens of hours trying in vain to get an HTTPS site to load.Here are my findings:
ESP-IDF v4.4 - got as far as establishing an LTE connection, but random semaphore exceptions were causing crashes.Arduino - got HTTP Get working but HTTPS handshake failed, error code 715. guessing because of cert not available, and no easy way of uploading them to the GSM7600 module. Couldn't get TinyGsm modem working.
UIFlow - was able to put Fire in Internet mode, set APN and add the required cert, it all looked great in terms of LTE connection - but when I then tried to run my app from the Apps widget on the device, it reboots before running it - losing the LTE connection it's just spent 2 minutes establishing!
I regard working with M5Stack products as a proper hacker challenge - working to stitch together what's needed from patchy documentation and few examples...
...but this one genuinely has got me beat at this point.
If anyone could point me in the right direction of a working example of HTTPS retrieval using LTE/4G rather than wifi, using any of the tools above, I'd be eternally grateful!
cheers, James
-
Hello @jimmyb
I was able to get data from google.com with the following AT commands:
AT+HTTPINIT AT+HTTPPARA="URL","https://www.google.com" AT+HTTPACTION=0 AT+HTTPHEAD AT+HTTPREAD=0,500 AT+HTTPTERM
Taken from this document.
Thanks
Felix -
Hi Felix,
thanks a lot for your reply.
it seems that some HTTPS sites (like Google and BBC) allow connection from the device.
Others, like the one I'm developing against (https://api-fxtrade.oanda.com) seem to be stricter - performing some additional cert/header validation that fails, even when the required header vals (e.g. Authorisation Bearer) have been set correctly by me.
My sample code works fine when run using a wifi network, but requires the "esp_crt_bundle_attach" param be set in the esp_http_client_config_t struct that's passed to esp_http_client_init().
I guess I need to try find the way of doing that when connected via LTE.
Cheers
James
-
-
@felmue Hi Felix,
yes, I couldn't get HTTPS working using that sample code and ESP-IDF 4.4.
I've found a solution, using MQTT commands with the LTE/4G module, that works well, using my own intermediary MQTT server running in Windows. I believe this is a better solution for my own needs, as it makes for smaller messages than HTTPS, hence less chance of them being dropped.Cheers
James
-
Hello @jimmyb
thank you for reporting back. I am glad you found a solution. And good luck with your project.
Thanks
Felix