AirLift is an ESP32 module. This module is a "co-processor", usually used to bring WiFi or BLE to the main processor.
AirLift modules are present in some Adafruit boards, like in:
Or it can be a standalone board:
AirLift modules come pre-installed with Adafruit's NINA firmware.
NOTE: Adafruit's NINA firmware is a fork of Arduino's NINA firmware. They are pretty similar, but they are not compatible since they use different SPI pins.
In order to have gamepad support, the original AirLift firmware must be replaced with Bluepad32 firmware. This is a simple step that needs to be done just once, and can be "undone" at any time.
This is how it works:
- Gamepad (A) talks to AirLift module (B)
- AirLift module (B) talks to main processor (C)
Bluepad32 firmware is "compatible-enough" with the original firmware:
- Uses SPI, and the same GPIOs to talk to the main processor
- Uses the same protocol that runs on top of SPI
- But not all messages are implemented. Only the ones that are needed to have gamepad support working.
To flash Bluepad32 firmware, you have to:
- Put the Adafruit board in "pass-through" mode
- Flash pre-compiled version
- Or compile it yourself and flash it.
Might slightly vary from board to board, but basically what you have to do is:
- Put the board in "boot" mode, usually by double pressing the "reset" button.
- Flash the right "Passthrough" firmware for your board.
- Details here: Adafruit's Upgrade AirLift firmware
Download latest pre-compiled version from here:
Unzip it, and follow the instructions described in the README.md
file.
Install the requirements described here: README.md.
Chose airlift
as the target platform:
cd {BLUEPAD32}/src/
# Select AirLift platform:
# Components config -> Bluepad32 -> Target Platform -> AirLift
idf.py menuconfig
# And then compile it!
idf.py build
To flash it, you have to use the --before no_reset
option:
# Flash it!
# Port might be different
export ESPPORT=/dev/ttyACM0
esptool.py --port ${ESPPORT} --baud 115200 --before no_reset write_flash 0x1000 ./build/bootloader/bootloader.bin 0x10000 ./build/bluepad32-airlift.bin 0x8000 ./build/partitions_singleapp.bin
The Bluepad32 library for CircuitPython, including a working example is available here:
ADVANCED: Normally you wouldn't need this.
Assuming that the ESP32 UART pins are not exposed (true for all AirLift modules), the recommended way to debug the Bluepad32 firmware is:
- Get any ESP32 breakout module. It could be an Adafruit HUZZAH32 or any other ESP32 breakout.
- JUST DON'T GET A ESP32-S2 (doesn't have Bluetooth!). JUST "ESP32"
- Get a SAMD51 module, like the Adafruit Feather M4 Express
- Wire it like this:
ESP32 | SAMD51 | |
---|---|---|
MOSI | 14 | MOSI |
MISO | 23 | MISO |
SCK | 18 | SCK |
CS | 5 | D10 |
READY | 33 | D9 |
RESET | EN | D6 |
Something like this (left: Feather M4 express, right: HUZZAH32)
NOTE: If you use a HUZZAH32, pay attention to the GPIO labels. The MOSI/MISO/SCK lables that are in the front of board, are not the ones that you should use. See the back of the board for the correct GPIO numbers.
In real life it might look more messy:
The benefits of using two separate modules (SAMD51 + ESP32) are:
- You can see the console of both the ESP32 and SAM51 at the same time
- Faster flashing: it is > 2x faster to flash Bluepad32 directly to the ESP32 than to flash it with "PassThrough" method required for AirLift modules.
- If needed, you can inspect the SPI protocol with a logic analizer