Maybe a bit of a longshot… but has anyone worked out how to do DFU OTA with an ESP8266? I note that the ESP32 implementation in the tutorial depends on the ExpressIf Esp-idf library to do the file partitioning etc. Is there such a thing for the ESP8266? There is an Arduino library for ESP8266 OTA firmware updates but it is based on WiFi and I don’t know enough to adapt that to the cellular Notecard.
Hey @rberkelm, can you share a pointer to the Arduino library you’re looking at for the 8266? Depending on the shape of it’s API, if there’s a way to just feed the library the binary one chunk at a time and it handles laying it down, it might not be too onerous to adapt since the Notecard handles downloading the binary and can send it to your host one chunk at a time.
Hi @bsatrom, if you have the ESP8266 core installed and one of its boards selected, it is under Examples->ArduinoOTA->BasicOTA. Wish I had your skills…
@rberkelm Just a small update on this - I am looking into implementing OTA DFU updates for ESP8266 this week and next I’ll keep you posted with updates.
Thanks Mat, appreciated!
@rberkelm some events the previous week meant I couldn’t put as much time as I thought into the research and implementation, but I’m back on the trail now.
HI @rberkelm! I’ve made a working example of Host firmware updates on the Adafruit Huzzah. Please see this PR esp8266 host DFU example by m-mcgowan · Pull Request #22 · blues/note-tutorials · GitHub.
It’s still a work in progress, but I wanted to give you an early heads up should you’d like to try it out.
flash the firmware in the v18.104.22.168 folder to your device. This is version 22.214.171.124. The device will post events every few seconds (up to 25 events for demo purposes.) with
countproperties. Notehub will show the firmware version on the device as v126.96.36.199.
PRODUCT_MINORto 1. This adds a
voltageproperty to the published events.
compile firmware and upload the binary to Notehub. (Note do not flash this to your device as that will defeat the purpose of the test.)
Select v188.8.131.52 as the host firmware for your device in Notehub
Within a minute or so the firmware will be downloaded to the Notecard and flashed to the Huzzah.
when the Huzzah restarts, Notehub will report the firmware version as v184.108.40.206 and you’ll see
voltagein the body of the published events.
Succinct instructions that I hope gets you started. Please reach out if anything is unclear.
Well done Mat!
I’d love to give it a try. What libraries do I need to install? I’m getting a compile error: fatal error: esp_partition.h: No such file or directory. This library is not available through the Arduino Library Manager. I think I’ve found it in Github as part of a massive master library called “ESP8266_RTOS_SDK-master”, but I’m not sure that is it? In any case, it won’t install as a zipped library. I’ve tried changing the name to remove the “-master” but still no go. You might have to give me more instructions?
Also , in the -binpack wrapping step, is there a new ESP8266 module specifier?
binpack is used only for Outboard DFU - you don’t need to use binpack for Host DFU - you can simply upload your compiled binary as is to notehub, as described in the ESP32 tutorial.
Regarding the compiler error, could you please double-check that you’re building the ESP8266 example, since it looks like you’re building the ESP32 example. The ESP8266 example isn’t yet merged to master, so you’ll need to pull down the repo and switch to the branch
mat-esp8266-dfu. I built and tested on the Adafruit Huzzah using both Arduino IDE and PlatformIO VSCode extension.
The only library required is the Blues Notecard Library, which you can install from the Library Manager. You will also need to install the corresponding Arduino BSP (Board Support Package) for your target hardware. Here’s the tutorial I followed for doing that.
I hope that helps!
Thanks Mat. I’m still getting the compile error and I’m definitely building for an ESP8266 and an Adafruit Huzzah at that.
fatal error: esp_partition.h: No such file or directory
To be clear, I’m copying your esp8266-dfu.ino file from here. Pasting into a new Arduino IDE sketch and compiling it. Nothing else.
Could you please post the full error output, which should show which file is trying to include that header. I don’t see it referenced in the sources, so I imagine it’s being called in the BSP. Thanks!
C:\Users\Ray Berkelmans\Documents\Arduino\libraries\esp32-dfu-v220.127.116.11\dfu.cpp:14:10: fatal error: esp_partition.h: No such file or directory
14 | #include “esp_partition.h”
exit status 1
Error compiling for board Adafruit Feather HUZZAH ESP8266.
So, it does indicate that it is trying to access an esp32-dfu library. That folder does exist but I don’t recall installing it. When I delete it I get a range of other errors, starting with main.h does not exist. When I add it manually through an extra tab in the sketch, I get many more errors.
Mat, unless the solution is simple, I might leave you to finish the job properly as I have very limited time to spend on this.
Thanks, that helps!
The DFU code in the
note-tutorials repo isn’t an Arduino library, so I’m puzzled why it is showing up in your libraries - it looks like somehow you installed the sources as a library. I suggest removing that folder and use
git to fetch the repo to a regular directory on your computer and then checkout the branch for the PR.
Then you can open the
esp8266-dfu-v18.104.22.168/esp8266-dfu folder in the Arduino IDE and compile. With that done, you should not see any reference to
This thing is looking to trip me up at every turn! I finally did manage to install git and learn how to download the repo. So now I have a folder with many subfolders and the one I’m expecting to see the ESP8266 DFU in isn’t there.
In the …\dfu-tutorials folder, all I see is ESP32
Are there some permissions settings that prevented the ESP8266 folders from cloning?
Thanks for persevering with this! We are definitely getting closer to the end, I promise!
In your git client (are you using the command line or something else?) you will need to check out the branch for the PR - the branch is called
From the command line you would run
git checkout mat-esp8266-dfu
This will then switch to that branch and update the files on your computer in that folder. You should then see the
esp8266 folder under
You can then open the sketch found at
esp8266-v22.214.171.124/esp8266-dfu in the Arduino IDE.
Best of luck, we will get there!
Ok, we got that far - I have the esp8266-dfu folders - phew! As for compiling… still not…
C:\Users\Ray Berkelmans\Documents\Arduino\ESP8266DFU\note-tutorials\dfu-tutorials\esp8266\esp8266-dfu-v126.96.36.199\esp8266-dfu\dfu.cpp: In lambda function:
dfu.cpp:28:30: error: ‘class UpdaterClass’ has no member named ‘getErrorString’
28 | notecard.logDebug(Update.getErrorString().c_str());
exit status 1
‘class UpdaterClass’ has no member named ‘onError’
I’m afraid that’s it for today.
That’s great, I think we’re on the home run!
The error you have is most likely because the Arduino package for the esp8266 is out of date. I am using version 3.1.0.
I installed the package following the directions in this tutorial.