Page 1 of 1

ESP32 using OTA updates

Posted: Tue Mar 17, 2020 6:10 pm
by kacpo1
Hi,

I need to implement OTA updates in my project. I found something like this: https://medium.com/@ronald.dehuysser/mi ... fde670d4eb

But everytime I'm trying to download this library to my ESP I've got wierd error and I don't know why...
Ready to download this file,please wait!
........
myfile.write(b"n(self.modulepath(self.main_dir))\r latest_version = self.get_latest_version()\r\r print('Checking version... ')\r")
124
>>>

download false6

Re: ESP32 using OTA updates

Posted: Fri Mar 20, 2020 3:08 am
by jimmo
Where is that error coming from? How are you copying the file to your device?

I recommend using pyboard.py (see docs at http://docs.micropython.org/en/latest/r ... rd.py.html ) or rshell (https://github.com/dhylands/rshell).

Re: ESP32 using OTA updates

Posted: Sat Mar 21, 2020 1:18 pm
by straga

Re: ESP32 using OTA updates

Posted: Wed Apr 01, 2020 8:20 pm
by tve
I believe the OP wants to update the python files in the filesystem, not update the MicroPython firmware itself? In that case the project linked by the OP seems appropriate.

@straga: you may want to update your OTA code to use the esp32.Partition class in order to select the next partition and to write the partition itself. It would result in a significant code reduction, IMHO. You can take a look at my (WIP) code that does that for OTA via MQTT: https://github.com/tve/micropython-mqtt ... py#L23-L71 That code is actually not MQTT specific at all, the handle function simply gets a buffer of additional OTA data, a sequence number, and a flag whether it's the last buffer. It's <50 lines total. I think of most interest to you would be the Partition class calls...

Re: ESP32 using OTA updates

Posted: Wed May 20, 2020 1:16 pm
by kinno
tve wrote:
Wed Apr 01, 2020 8:20 pm
I believe the OP wants to update the python files in the filesystem, not update the MicroPython firmware itself? In that case the project linked by the OP seems appropriate.

@straga: you may want to update your OTA code to use the esp32.Partition class in order to select the next partition and to write the partition itself. It would result in a significant code reduction, IMHO. You can take a look at my (WIP) code that does that for OTA via MQTT: https://github.com/tve/micropython-mqtt ... py#L23-L71 That code is actually not MQTT specific at all, the handle function simply gets a buffer of additional OTA data, a sequence number, and a flag whether it's the last buffer. It's <50 lines total. I think of most interest to you would be the Partition class calls...
I am really interested in your project MQTT repl, OTA, etc. What is the current status? I will probably begin testing on some devices I have shortly. Would you be open to feedback? If so DM the best way to connect with you. I think MQTT repl and OTA are massive features for micropython and in my case the ESP32. Thanks for the work.

Re: ESP32 using OTA updates

Posted: Wed May 20, 2020 4:41 pm
by tve
The current state is that I'm a couple of days away from a beta release of my MQTT "micro-framework". I have now spent a couple of weeks quite happy updating code on remote boards that are only connected via one MQTTS connection. I have also done my first MP firmware OTA update over MQTTS of a remote "production" board, i.e. one I really didn't want to loose. I'm currently reworking various APIs based on learnings and need to update the docs.
The "framework" part concerns having various services and application portions in python modules that get loaded by main.py based on a board config. That makes it easy to add modules to boards. It also includes repl-like functionality over MQTT and remote logging, including buffering boot-time logs until a connection gets established so you can see how the thing booted up.
Everything is freely available at https://github.com/tve/micropython-mqtt, but as mentioned, I'm making a pile of little changes... WRT communication, there are github issues, this forum, and I'm also active on the MP slack.
I should also mention that all the above relies on my fork of MP, which includes a bunch of PRs that are somewhere in the (glacial) PR pipeline. The most pertinent are adding TLS support for usyncio and fixing machine.RTC.memory so it actually works.

Re: ESP32 using OTA updates

Posted: Tue Jan 12, 2021 9:58 am
by smysnk
Would like to put my hat in to the ring regarding OTA updating. Did a bit of a re-write of rdehuyss's GitHub implementation, check it out here: https://github.com/smysnk/micropython-ota-updater