Flashing new firmware to onboard ESP8285/ESP32-C3/ESP32-C6 devices.
Update 2024-12-09
As of December 2024 new ESP32 software packages will be distributed as a self contained UF2 that require very little intervention by the user.
Simply set your Challenger board in bootloader mode (By pressing the BOOT button while clicking the RESET button) and copy the UF2 file to the RPI-RP2 or RP2350 disk that pops up in your operating system. The Challenger board will upload the firmware upgrade and start flashing the ESP32 with the new firmware. It will blink the LED steadily while doing the upgrade and when it is done it will turn the LED off.
Please note that this only applies to new updates after December 2024. Earlier updates still use the procedure described below.
Update 2024-10-06
These instruction also applies to our RP2350 boards.
Introduction
The Challenger RP2040 series boards that have WiFi and or BLE functionality are based on one of the popular network devices from Espressif: ESP8285, ESP32-C3 or ESP32-C6. Before the boards are shipped they are flashed with an AT based firmware that allows the RP2040 to send easy to use AT commands to accomplish different network activities such as connecting to a network, server, sending an email or act as a iBeacon.
This firmware can be very easily be upgraded over USB by using the standard ESP tool esptool.py.
How to
The ESP-device is connected to the RP2040 via a serial channel together with control signals to put the ESP-device in flash boot mode, allowing new firmware to be uploaded.
In order for this to work you need to flash an appropriate USB2Serial gateway on your RP2040 device. You can use this Arduino sketch for this or if you feel adventurous write your own program for this.
Next you need the tool to communicate with the ESP device. This tool is called esptool.py and is used to read the contents from the ESP or simply upload programs to the FLASH memory on the device. You can use the official tool from Espressif which is found here but your mileage may vary. We have found that their reset mechanisms are not fully correct which causes problems when detecting an ESP device. We’ve fixed this by creating a specific reset mechanism that suits our our RP2040 based USB2Serial firmware very well. This tool is downloaded from here and it follows the changes from the parent repo so you always get the latest and greatest.
With all of this in place you should be able to type something like this:
> python3 ./esptool.py -p /dev/ttyACM0 flash_id
And get something like this in response:
esptool.py v4.7-dev
Serial port /dev/ttyACM0
Connecting…RP2040 reset
.
Detecting chip type… ESP32-C6
Chip is ESP32-C6FH4 (QFN32) (revision v0.0)
Features: WiFi 6, BT 5, IEEE802.15.4
Crystal is 40MHz
MAC: 40:4c:ca:ff:fe:40:c4:f4
BASE MAC: 40:4c:ca:40:c4:f4
MAC_EXT: ff:fe
Uploading stub…
Running stub…
Stub running…
Manufacturer: 20
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin…
Excellent, now we have proper contact with the ESP device on the board. Of course depending on the actual device that is on your Challenger board the result will be slightly different.
Next we will flash a new firmware into the device with the following line:
> python3 ~/bin/esptool/esptool.py -p /dev/ttyACM0 -b 2000000 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0 ./factory_CHALLENGER_RP2040_WB_V2.4.0.0.bin
This will upload the file factory_CHALLENGER_RP2040_WB_V2.4.0.0.bin to the ESP flash memory. The output from the tool looks like this:
esptool.py v4.7-dev
Serial port /dev/ttyACM0
Connecting…RP2040 reset
.
Detecting chip type… ESP32-C3
Chip is ESP32-C3 (revision v0.3)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 34:b4:72:aa:44:58
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 2000000
Changed.
Configuring flash size…
Flash will be erased from 0x00000000 to 0x001abfff…
Compressed 1749088 bytes to 812216…
Wrote 1749088 bytes (812216 compressed) at 0x00000000 in 24.0 seconds (effective 583.3 kbit/s)…
Hash of data verified.
Leaving…
Hard resetting via RTS pin…
The output displays the progress of the download and some stats about it when it is done. You can also see that I changed the upload baud rate to 2MBit/s to reduce the FLASH’ing time.
Conclusion
In this tutorial, we have shown you how to upload new firmware to the ESP device on your Challenger RP2040 WiFi/BLE board using the RP2040 as a USB2Serial adapter. There are other ways to update the AT firmware using OTA but this will have to wait for another day.
I received my new Challenger RP2040 WIFI/BLE and am unable to get proper contact. You made the statement above (You can use this Arduino sketch for this) but I see no sketch available. Sorry for the trouble, I am rather new to this and still have a lot to learn
Hi William,
For technical support head over to our Discord server.
There is an invitation in the order confirmation that you can use.
/Pontus
Thank you