-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP-IDF OTA update with cellular network interface #236
Comments
Hi there: yup, that sounds like the right approach to use the native ESP-IDF IP stack and OTA download. The other option you have is to use cellular sockets but not cellular HTTP (so avoiding any internal HTTP-download file-size limitations within the cellular module) to download your update file and then locally apply it within ESP-IDF. I wrote an example of how to do that for another customer here; the example does not include locally applying the file within ESP-IDF as I didn't know how to do that. The reason I mention the latter is that using PPP will invoke CMUX and, since both CMUX and PPP are framed protocols, should your UART suffer any character loss the connection will likely mess up. That said, we have other customers doing exactly this (on ESP-IDF) who have not had a problem that I am aware of, I just thought I'd mention it. On your questions:
If you're using PPP, and therefore ESP-IDF's IP stack, the cellular module will not need to know about any TLS credentials.
I would have thought so but this is really an ESP-IDF question; I don't know how they do routing within their IP stack. We don't have an example of doing FOTA stuff as it tends to end up being quite platform/application specific. |
Thanks for your thoughts @RobMeades. I went ahead and tried the PPP approach and was able to successfully download and apply a small .bin file (169 KB). Success Log
Unfortunately, I've run into issues when trying to download a realistic update (1.3 MB). I'm not sure if there a timeout or memory limit that I'm hitting, or if there's some loss which is causing a problem like you mentioned. Fail Log
I tried implementing your sockets example, but I wasn't able to make a connection to my server. This is likely something that's wrong on my end. I will try to see if I can figure that out. The issues I'm having don't seem to be related to Another Fail Log
|
Of course, it will be interesting to see how things go. LWIP I guess you have the UART flow control lines connected? That might become important if there is a lot of data to download. If you suspect a PPP issue it might be that one or both of these would give you diagnostic information, if they don't drown the debug output of course:
Another debug option would be to attach something like a Saleae probe to the UART lines and capture the entire transaction; might be a big file of course but would have all of the raw detail we might need in it. |
Thanks for the insight.
I believe you are correct on this.
Flow control is not connected on my hardware. More on this later. I enabled the debug logging as you suggested and it doesn't give too much info, but there are a few things to note. First, the update is aborted after what appears to be a timeout (see consecutive Debug log
This, along with your comment about hardware flow control, led me to try different hardware that does have hardware flow control (SparkFun SARA-R5 breakout board with an ESP32 devkit). Surprisingly, this board downloaded the update on the first try (and at a much faster speed)! It also never reported the checksum failure. This definitely indicates that I have a hardware issue. Do you really think that UART flow control is that important? I think another hardware difference with the SparkFun board is that it has level-shifting chips, whereas I am using transistors to match voltage levels. I appreciate your help! |
We always advise that it is connected; even at 115200 it can be an issue. Thing is that you are running two framed protocols: CMUX and then PPP on top of that. In particular, CMUX is running a CMUX control channel, an AT channel (which will be doing nothing unless you use a Basically, the link is critically sensitive to bit errors on the UART. In terms of level shifting chips v transistors, I couldn't really say; all I know is that standard bi-directional level-shifting chips definitely don't work with flow control lines, for some reason, but I guess the SparkFun HW has properly designed level-shifting HW. For this reason we actually end up without flow control on a few of our test instances and we relatively rarely have a problem but, on the other hand, we aren't doing 1.3 Mbyte downloads over PPP either. So, if at all possible, have HW flow control I think. |
Thanks for your suggestions @RobMeades! |
Hi, I need the ability to do an OTA update for my MCU, an ESP32, over a SARA-R5 cell network. I am currently using the
esp-idf
withubxlib
and have an idea on how to approach this, but wanted to get feedback before I attempted it.My thought is that if I use the PPP interface as in this sockets example, I should be able to use the
esp-idf
OTA API similar to this example.Is this approach correct?
esp-idf
network interface (like this).ubxlib
network interface and bring up the cellular network.esp-idf
OTA API to download and install update.A few questions...
I wasn't able to find an existing example for this scenario but if it's out there, please point me in that direction. Thanks!
The text was updated successfully, but these errors were encountered: