DFU OTA with ESP8266?

Could you run the request {"req":"dfu.status"} and post the result? It sounds like Host DFU might be disabled on your Notecard.

I couldn’t quite understand the response of the dfu request. It was the same before and after the dfu ''off" request.

{“req”:“card.dfu”}
{
“mode”: “aux”,
“name”: “esp32”
}

I figured you needed some good news today, so I got a new notecard out of the box and upgraded the Notecard firmware to 2.4.1.2014024. I then queued a host dfu upgrade. Unfortunately, the firmware again did not propagate to the esp. I’ve repeated the procedure a few times, re-booting the esp after the notecard fires up.


I also did a dfu status request of the new notecard:

{"req":"card.dfu"}
{
"err": "unknown request type: card.dfu {io}"
}

What response would you expect?

Just to be completely clear, the request I was interested in is dfu.status rather than card.dfu.

card.dfu is used for Outboard firmware updates (In-System Programming), where the notecard uses the ROM bootloader of the device to send over the firmware to the host without requiring any application code on the host.

dfu.* requests are for Host-assisted firmware updates (In-Application Programming) where the host application takes part in downloading the firmware from the notecard and writing it to the host’s memory.

card.dfu is a relatively new feature, launched with firmware 3.5.1, which is why it’s not recognized on firmware 2.4.1. But that’s just for information - it shouldn’t have any impact here, so long as the goal is In-Application programming.

The ESP8266 example that we’re discussing here uses In-Application programming (via dfu.* requests.). However, I gather from the wiring you posted earlier you want to use Outboard DFU?

I’ve found at least a couple of variants of the Wemo D1 mini. Could you provide a link to the Wemo D1 mini you are using (ideally with a datasheet and schematic.) With that, I should be able to help you move forward with this.

Thanks!
mat.

Apologies, I did misread your dfu.status instruction. I’ve run the request for both notecards and both returned

{“req”:“dfu.status”}
{
“status”: “successfully downloaded”,
“mode”: “ready”,
“on”: true
}

As for the wiring, I don’t specifically want to use Outboard - which ever works really. I was just trying to second guess what the wiring would be since I didn’t have either a Notecard AF or an esp8266 huzzah feather.
My D1 mini looks like this and there is a schematic here.

Thanks for the info! For the IAP firmware update, you don’t need any wiring other than what you would typically use to connect to the Notecard. In this case, either GND/TX/RX on your device to GND/RX/TX on the Notecarrier-A for serial communications, or GND/SCL/SDA between both devices for I2C.

Please try the sketch again with either of these wirings. Should the firmware update not happen, please capture and post the output from the Arduino IDE serial monitor, which will show what is being sent over the wire.

Best,
mat.

btw, the Sketch in the repo is set up for I2C communications. If you wish to use serial, you’ll need to change the code. Please see this tutorial for configuring Serial communication with the Notecard.

Hi Mat, that is really important information - thank you! It would have been good to have that at the start, but no matter, we got there in the end! I2C comms it is.
So, yes, we have success!!

I think the whole DFU update took about 12 minutes which is pretty good.
Despite my stumbles at the start, I actually like the IAP firmware update better than Outboard. Code wise, it is pretty much all in the dfuSetup() and dfuPoll(true) lines, as far as I can tell, so not much code overhead at all. Yes, there is the firmware version stuff, but that should probably also be used in the Outboard method. I especially like not having to have any special writing, so no board revision required on my part!
Thanks again Matt - you are a guru!

1 Like

I’m very happy to hear it’s working for you!

I didn’t think to mention I2C to begin with, it’s very much the norm for our NoteCarriers so I overlooked it unfortunately. I’ll add that info to the readme for the example.

Regarding the dfuPoll(true) call, where are you calling that from? Just for information, it’s best to only call with true in infrequent circumstances (such as from user input) and not very frequently (e.g. from loop()).

I’m glad you have Host DFU working. Host DFU and Outboard DFU have the same goal, but different approaches, each with their own merits. I’m pleased that we’ve found a solution that works for you!

Best,
mat.