adafruit learning system ESP32 User manual

Upgrading ESP32 Firmware
Created by Brent Rubell
Last updated on 2021-03-29 01:04:43 PM EDT

2
3
3
3
3
5
7
8
8
9
10
10
10
11
12
12
13
14
14
15
15
16
16
16
18
18
19
19
20
22
23
23
Guide Contents
Guide Contents
Overview
Why would I update my ESP32's firmware?
Parts
External ESP32 Co-Processors
ESP32 Co-Processor All-in-One Boards
Materials
Upgrade All-in-One ESP32 AirLift Firmware
Uploading Serial Passthrough Code
Install esptool.py
Uploading nina-fw with esptool
Verifying the Upgraded Firmware Version
Arduino
CircuitPython
Upgrade External ESP32 Airlift Firmware
External AirLift FeatherWing, Shield, or ItsyWing
Upload Serial Passthrough code for Feather or ItsyBitsy
External AirLift Breakout
Code Usage
Install esptool.py
Burning nina-fw with esptool
Verifying the Upgraded Firmware Version
Arduino
CircuitPython
Upgrade RP2040 AirLift Firmware
Upload Serial Passthrough Code
Download NINA Firmware
Flash AirLift using Web Serial ESPTool
Enable Chrome's Web Serial API
Flash AirLift using esptool.py
Burning nina-fw with esptool
Verifying the Upgraded Firmware Version
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 2 of 25

Overview
If you want to keep the firmware on your ESP32 WiFi-BLE co-processor up-to-date, you'll need to update
the firmware on the ESP32.
You're going to to turn your board into a USB-to-Serial converter to flash new firmware to your ESP32 -
no extra hardware required !
This process is mostly setup and should take from 10 to 20 minutes.
This guide is not for when you are running Arduino/MicroPython/FreeRTOS/etc *directly* on the
ESP32, this is only for using the ESP32 as an AirLift/WiFi co-processor!
To support BLE on the ESP32 AirLift, you'll need NINA_W102-1.7.1.bin or later.
Why would I update my ESP32's firmware?
Using an ESP32 as a WiFi-BLE co-processor is a way to connect your CircuitPython and Arduino projects
to the internet. Having WiFi managed by a separate chip means your code is simpler, you don't have to
cache socket data, or compile in & debug an SSL library.
Adafruit ships a variety of products which use the ESP32 as a WiFi-BLE co-processor with a variant of the
Arduino nina-fw core (https://adafru.it/FWj). This firmware is programmed to the ESP32 at the Adafruit
factory. If you wish to update to a newer version of nina-fw, you'll need to program it to the ESP32.
BLE is supported on the ESP32 co-processor only with version NINA_W102-1.7.1.bin or later of the
firmware (released in October 2020). If you want BLE support, it is quite likely you'll need to upgrade
Parts
External ESP32 Co-Processors
If you already have a project which uses a popular microcontroller (like the ATMega328 or ATSAMD51),
you can easily add WiFi by using an externally connected ESP32 module.
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 3 of 25

Adafruit AirLift – ESP32 WiFi Co-Processor Breakout Board
Give your plain ol' microcontroller project a lift with the Adafruit AirLift - a breakout board that lets you use
the powerful ESP32 as a WiFi co-processor. You probably...
$9.95
In Stock
Add to Cart
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 4 of 25

Adafruit AirLift FeatherWing – ESP32 WiFi Co-Processor
Give your Feather project a lift with the Adafruit AirLift FeatherWing - a FeatherWing that lets you use the
powerful ESP32 as a WiFi co-processor. You probably have your...
$12.95
In Stock
Adafruit AirLift Shield - ESP32 WiFi Co-Processor
Give your Arduino project a lift with the Adafruit AirLift Shield - a shield that lets you use the powerful
ESP32 as a WiFi co-processor. You probably have your favorite...
$14.95
In Stock
Your browser does not support the video tag.
Adafruit AirLift Bitsy Add-On – ESP32 WiFi Co-Processor
Give your ItsyBitsy project a lift with the Adafruit AirLift Bitsy Add-On - a daughterboard that lets you use
the powerful ESP32 as a WiFi co-processor. You probably have your...
Out of Stock
ESP32 Co-Processor All-in-One Boards
Don't want to add extra hardware to your project?
Consider grabbing a board which has an ESP32 WiFi
co-processor built-in.
Add to Cart
Add to Cart
Out of
Stock
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 5 of 25

Adafruit PyPortal - CircuitPython Powered Internet Display
PyPortal, our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in
minutes. Make custom touch screen interface...
Out of Stock
Adafruit Metro M4 Express AirLift (WiFi) - Lite
Out of
Stock
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 6 of 25

Give your next project a lift with AirLift - our witty name for the ESP32 co-processor that graces this Metro
M4. You already know about the Adafruit Metro...
$34.95
In Stock
Materials
1 x USB Cable
USB cable - USB A to Micro-B - 3 foot long
Add to Cart
Add to Cart
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 7 of 25

Upgrade All-in-One ESP32 AirLift Firmware
To support BLE on the ESP32 AirLift, you'll need NINA_W102-1.7.1.bin or later.
Uploading Serial Passthrough Code
First, back up any code and files you have on your CIRCUITPY drive . It will be overwritten by the code
you're going to upload to your board. You should not end up losing any files on the QSPI flash, but it's a
good idea to back them up anyways.
Download the UF2 for your board to your Desktop.
https://adafru.it/Ep1
https://adafru.it/END
https://adafru.it/Obx
https://adafru.it/F98
Find the reset button on your board. It's a small, black button, and on most of the boards, it will be the only
button available.
Tap this button twice to enter the bootloader. If it doesn't work on the first try, don't be discouraged. The
rhythm of the taps needs to be correct and sometimes it takes a few tries.
Once successful, the RGB LED on the board will flash red and then stay green. A new drive will show up
on your computer. The drive will be called boardnameBOOT where boardname is a reference to your
specific board. For example, a Feather will have FEATHERBOOT and a Trinket will
have TRINKETBOOT etc. Going forward we'll just call the boot drive BOOT
https://adafru.it/Ep1
https://adafru.it/END
https://adafru.it/Obx
https://adafru.it/F98
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 8 of 25

The board is now in bootloader mode. Now find the UF2 file you downloaded. Drag that file to
the BOOT drive on your computer.
The lights should flash again, BOOT will disappear. It should re-enumerate USB and appear as a COM or
Serial port on your computer. Make a note of the serial port by checking the Device Manager (windows) or
typing ls /dev/cu* or /dev/tty* (Mac or Linux) in a terminal.
If you see your board listed in the terminal: Proceed to the Uploading nina-fw with esptool section of this
page.
This guide assumes you have Python3 installed. If you have not installed it, navigate to the Python
downloads page (https://www.python.org/downloads) and install the latest release.
Install esptool.py
Esptool is an application which can communicate with the ROM bootloader (https://adafru.it/LKe) in
Espressif chips.
To install esptool, run the following in your terminal :
pip3 install esptool
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 9 of 25

Uploading nina-fw with esptool
Click the link below to download the latest nina-fw .bin file. Unzip it and save the .bin file to your desktop .
https://adafru.it/G3D
If you're using macOS or Linux - run the following command, replacing /dev/ttyACM0 with the serial port of
your board and NINA_W102-1.6.0 with the binary file you're flashing to the ESP32.
esptool.py --port /dev/ttyACM0 --before no_reset --baud 115200 write_flash 0 NINA_W102-1.6.0.bin
If you're using Windows - run the following command, replacing COM7 with the serial port of your board
and NINA_W102-1.6.0 with the binary file you're flashing to the ESP32
esptool.py --port COM7 --before no_reset --baud 115200 write_flash 0 NINA_W102-1.6.0.bin
The command should detect the ESP32 and will take a minute or two to upload the firmware. The NeoPixel
on your board will flicker and flash as the firmware uploads.
If ESPTool doesn't detect the ESP32
, make sure you've uploaded the correct .UF2 file to the bootloader.
Once the firmware is fully uploaded, the ESP32 will reset and the NeoPixel will glow blue.
Verifying the Upgraded Firmware Version
Arduino
To verify everything is working correctly, we'll load up either an Arduino sketch or CircuitPython code.
https://adafru.it/G3D
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 10 of 25

If you were previously using your ESP32 with Arduino, you should load up an Arduino sketch to verify
everything is working properly and the version of the nina-fw correlates with the version the sketch reads.
Open up File->Examples->WiFiNINA->ScanNetworks and upload the sketch. Then, open the Serial
Monitor. You should see the firmware version printed out to the serial monitor.
CircuitPython
If you were previously using your ESP32 with CircuitPython, you'll need to first reinstall CircuitPython
firmware (UF2) for your board. The QSPI flash should have retained its contents. If you don't see anything
on the CIRCUITPY volume, copy files from the backup you made earlier over to CIRCUITPY .
To verify the new ESP32 WiFi firmware version is correct, follow the Connect to WiFi step in this
guide (https://adafru.it/Eao) and come back here when you've successfully ran the code. The REPL output
should display the firmware version you uploaded.
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 11 of 25

Upgrade External ESP32 Airlift Firmware
To support BLE on the ESP32 AirLift, you'll need NINA_W102-1.7.1.bin or later.
External AirLift FeatherWing, Shield, or ItsyWing
External AirLift boards have three optional ESP32 control pins which are not connected by default:
ESPGPIO0
ESPRX
ESPTX
Make sure to solder each of these pads together. You will not
be able to upload firmware to your ESP32 if they are not
connected.
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 12 of 25

Upload Serial Passthrough code for Feather or ItsyBitsy
First, back up any code and files you have on your CIRCUITPY drive . It will be overwritten by the code
you're going to upload to your board. You should not end up losing any files on the QSPI flash, but it's a
good idea to back them up anyways.
This section is only for an AirLift FeatherWing with a Feather M4, or an AirLift BitsyWing with an
ItsyBitsy M4. If you are using a different hardware combination - scroll down to the "External AirLift
Breakout" section.
Download the UF2 for your board to your Desktop.
https://adafru.it/OYF
https://adafru.it/PTE
https://adafru.it/IEK
Find the reset button on your board. It's a small, black button, and on most of the boards, it will be the only
button available.
Tap this button twice to enter the bootloader. If it doesn't work on the first try, don't be discouraged. The
rhythm of the taps needs to be correct and sometimes it takes a few tries.
Once successful, the RGB LED on the board will flash red and then stay green. A new drive will show up
on your computer. The drive will be called boardnameBOOT where boardname is a reference to your
specific board. For example, a Feather will have FEATHERBOOT and a Trinket will
have TRINKETBOOT etc. Going forward we'll just call the boot drive BOOT
The board is now in bootloader mode. Now find the UF2 file you downloaded. Drag that file to the BOOT
drive on your computer in your operating system file manager/finder.
https://adafru.it/OYF
https://adafru.it/PTE
https://adafru.it/IEK
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 13 of 25

The lights should flash again, BOOT will disappear. Your board should re-enumerate USB and appear as a
COM or Serial port on your computer. Make a note of the serial port by checking the Device Manager
(Windows) or typing ls /dev/cu* or /dev/tty* (Mac or Linux) in a terminal.
If your board is listed in the terminal, proceed to the Uploading nina-fw with esptool section of this guide.
External AirLift Breakout
You'll be turning your Arduino board into a USB to Serial converter. To do this, you'll need a special
Arduino sketch named SerialESPPassthrough.ino and an Arduino-compatible board with Native USB
support such as the Adafruit Metro M4.
You will also need to make the following connections between the board and the AirLift Breakout:
Board Pin 12 to ESP32_ResetN
Board Pin 10 to ESP32 GPIO0
Board TX to RXI
Board RX to TX0
Click
Download: Project ZIP
to download the code below.
Temporarily unable to load content:
Code Usage
Unzip the file, and open the SerialESPPassthrough.ino file in the Arduino IDE.
If you're using the AirLift FeatherWing, AirLift Shield or AirLift Bitsy Add-On, use the PassThrough UF2
instructions above
If you have an AirLift Breakout (or are manually wiring up any of the boards above), change the following
pin definitions in the sketch to match your wiring:
#elif !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
// Don't change the names of these #define's! they match the variant ones
#define SerialESP32 Serial1
#define SPIWIFI SPI
#define SPIWIFI_SS 10 // Chip select pin
#define SPIWIFI_ACK 7 // a.k.a BUSY or READY pin
#define ESP32_RESETN 5 // Reset pin
#define ESP32_GPIO0 -1 // Not connected
#define NEOPIXEL_PIN 8
#endif
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 14 of 25

Using the Arduino IDE, upload the code to your board (
Sketch->Upload
).
After uploading, the board should enumerate USB and appear as a COM or Serial port on your computer.
Make a note of the serial port by checking the Device Manager (Windows) or typing in ls
/dev/cu* or /dev/tty* (Mac or Linux) in a terminal
This guide assumes you have Python3 installed. If you have not installed it, navigate to the Python
downloads page (https://www.python.org/downloads) and install the latest release.
Install esptool.py
Esptool is an application which can communicate with the ROM bootloader (https://adafru.it/LKe) in
Espressif chips.
To install esptool, run the following in your terminal :
pip3 install esptool
Burning nina-fw with esptool
Click the link below to download the latest nina-fw .bin file. Unzip it and save the .bin file to your desktop .
https://adafru.it/G3D
If you're using macOS or Linux - run the following command, replacing /dev/ttyACM0 with the serial port of
your board and NINA_W102-1.6.0 with the binary file you're flashing to the ESP32.
esptool.py --port /dev/ttyACM0 --before no_reset --baud 115200 write_flash 0 NINA_W102-1.6.0.bin
If you're using Windows - run the following command, replacing COM7 with the serial port of your board
and NINA_W102-1.6.0 with the binary file you're flashing to the ESP32
esptool.py --port COM7 --before no_reset --baud 115200 write_flash 0 NINA_W102-1.6.0.bin
The command should detect the ESP32 and will take a minute or two to upload the firmware.
https://adafru.it/G3D
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 15 of 25

If ESPTool doesn't detect the ESP32
, make sure you've uploaded the correct .UF2 file to the bootloader
and are using the correct serial port.
Once the firmware is fully uploaded, the ESP32 will reset.
Verifying the Upgraded Firmware Version
To verify everything is working correctly, we'll load up either an Arduino sketch or CircuitPython code. At
this point, you must desolder the connections between the Optional ESP32 control pins you made
earlier using a solder sucker (https://adafru.it/FWk) or a bit of solder wick (https://adafru.it/yrC).
Arduino
If you were previously using your ESP32 with Arduino, you should load up an Arduino sketch to verify
everything is working properly and the version of the nina-fw correlates with the version the sketch reads.
Open up File->Examples->WiFiNINA->ScanNetworks and upload the sketch. Then, open the Serial
Monitor. You should see the firmware version printed out to the serial monitor.
CircuitPython
If you were previously using your ESP32 project with CircuitPython , you'll need to first reinstall
CircuitPython firmware (UF2) for your board. The QSPI flash should have retained its contents. If you don't
see anything on the CIRCUITPY volume, copy files from the backup you made earlier to CIRCUITPY .
To verify the new ESP32 WiFi firmware version is correct, follow the Connect to WiFi step in this
guide (https://adafru.it/Eao) and come back here when you've successfully ran the code. The REPL output
should display the firmware version you flashed.
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 16 of 25

© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 17 of 25

Upgrade RP2040 AirLift Firmware
Upload Serial Passthrough Code
If you have already installed CircuitPython, back up any code and files you have on your CIRCUITPY
drive. It will be overwritten by the code you're going to upload to your board. You should not end up losing
any files on the QSPI flash, but it's a good idea to back them up anyways.
Download the UF2 for your board to your Desktop:
https://adafru.it/Rod
https://adafru.it/Roe
To enter bootloader mode, start with your RP2040 board
unplugged from USB.
Press and hold the BOOTSEL button (highlighted in red in the
image of the Feather RP2040, but all RP2040 boards should
include this button), continue to hold it while plugging it into
USB, and wait for the RPI-RP2 drive to appear before
releasing the button.
You will see a new disk drive appear called RPI-RP2. The
board is now in bootloader mode.
Find the UF2 file you downloaded. Drag that file to the RPI-RP2 drive on your computer in your operating
system file manager/finder.
https://adafru.it/Rod
https://adafru.it/Roe
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 18 of 25

The board's LED should flash, RPI-RPI2 will disappear. Your board should re-enumerate USB and appear
as a COM or Serial port on your computer. Make a note of the serial port by checking the Device Manager
(Windows) or typing ls /dev/cu* or /dev/tty* (Mac or Linux) in a terminal.
Download NINA Firmware
Click the link below to download the latest version of the NINA firmware. Unzip it and save the .bin file to
your desktop.
To support BLE on the ESP32 AirLift, you'll need NINA_W102-1.7.1.bin or later.
https://adafru.it/G3D
Next, you'll need to flash the firmware to your ESP32 AirLift module. If you're using the Google Chrome
browser, you may follow the instructions below for programming using our web-based ESPTool.
Otherwise, scroll down and follow the instructions for flashing using the Python esptool.py program.
Flash AirLift using Web Serial ESPTool
If you have a computer with the Google Chrome browser, we've created the WebSerial ESPTool as an
option for programming ESP32 boards.
Safari and Firefox, etc are
not
supported because we need Web Serial and only Chrome is supporting it to
the level needed. If you're using an unsupported browser , you'll need to upgrade using the Python
esptool.py program on your computer (Scroll down to
Upgrade with esptool.py,
)
https://adafru.it/G3D
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 19 of 25

Enable Chrome's Web Serial API
At the time of this tutorial, you'll need to enable the Serial API,
which is really easy.
Visit chrome://flags from within Chrome. Find and enable
the Experimental Web Platform features
Restart Chrome
Next, navigate to https://adafruit.github.io/Adafruit_WebSerial_ESPTool (https://adafru.it/PMB). In the top-
right corner of your browser, select 115200 as the baud rate and click the Connect button.
You will get a pop-up asking you to select the Pico's COM or Serial port. You may want to remove all other
USB devices so only the ESP32-S2 board is attached, that way there's no confusion over multiple ports!
Click Connect.
© Adafruit Industries https://learn.adafruit.com/upgrading-esp32-firmware Page 20 of 25
Other adafruit learning system Microcontroller manuals
Popular Microcontroller manuals by other brands

Altera
Altera Cyclone III user guide

Texas Instruments
Texas Instruments CC1120 quick start guide

Cypress
Cypress CY8CKIT-001 quick start guide

mikroElektronika
mikroElektronika mikromedia for ARM user guide

NXP Semiconductors
NXP Semiconductors MKL27Z128VFM4 Reference manual

Atmel
Atmel AVR042 Application note