Skip to content

Espressif WLAN Mavlink Router and Bridge Development

James F. Dougherty edited this page Dec 12, 2022 · 2 revisions

Notes on ESP82xx WLAN modules for MAV relay/router/bridge development.

Supported Modules

Supported Platforms

The below list is hardware which has been used for testing or in flight. This is not an exhaustive list but rather baselines which have been used with great success.

ESP8266 Dev Setup (for firmware development and flight) - Stable

ESP32 WROOM Dev Setup (for firmware development)

Maverick Router ESP32 WROOM setup (Flight Hardware) - Stable

  • ESP32-WROOM-32U-N4
  • See ESP32-WROOM-32UE Datasheet
  • Trace / Impedance matched UART routing for over 1 Megabaud with no errors
  • u.FL to WLAN module
  • Panduit PLT.6SM strain relief to RG158 coax
  • Mobile Mark PSKN3-24/55S 802.11 a/b/g/n WLAN antennas
  • Multiple WAN Radios (off-topic)
  • JST-GH Pixhawk2 / Dronecode / Ardupilot Telemetry port

ESP32-S3-DevKitM-1 (for firmware development) - In progress

Goose ESP32-S3 Next Revision (Flight Hardware) - In Progress

SDK Notes

ESP8266

The original port uses platform = [email protected] in the platformio.ini file.

ESP32-WROOM

This is the new Dual-Core module from Espressif which features an external u.FL cable. For most use cases, this is the module to use due to its prevalence, simple module design, and low cost. Performance is quite good, especially with an external antenna. To build for this platform, you must have platform=espressif32 in your platformio.ini configuration file. Notable is the define ARDUINO_ESP32_DEV which is set when building and using the Arduino framework on ESP32 architecture modules.

ESP32-S3

This is a newer module from Espressif which includes USB and a BTLE core (among other things). It is NOT pin-out compatible with the ESP32-WROOM module. To build for this platform, you must have platform = [email protected] in your platformio.ini file. Notable is the define ARDUINO_ESP32S3_DEV which is set when building and using the Arduino framework on ESP32S3 architecture modules.

ESP32-C3

This is an even more recent version of ESP32 which uses a RISCV processor core. More details to follow.

PlatformIO Debugging notes

Verbose

Add the option build_flags = -v to get all compiler output. Useful to see what is defined for the build.

Programming notes

esp-prog

If you want to do anything serious with these modules, spend the $20 and get the ESP-PROG programmer, yes, you can do it with an FTDI cable, but this is officially supported hardware.

  • ESP-PROG Intro PDF
  • ESP-PROG Intro Official Users Manual

ESP32WROOM

The best overall way to program this module is with esp-prog, this is the official programmer for ESP modules. It can be purchased from Digikey as ESP-PROG. Connect TDI/TMS/TDO/TCK and Ground. To make the module go into bootloader mode, follow these steps:

  • To go into boot-loader mode, set these boot-straps (most all boards have a RESET and IO0 or BOOT jumper):
    • BOOT0 pin strapped to ground (IO0 pulled low).
    • RESET jumpered (RESET pulled low)
  • Now power-up the board
  • Wait 2 seconds to ensure power is stable, remove Reset Jumper
  • Insert Reset Jumper, wait 1 second, remove reset jumper
  • System is now ready to be programmed via esp-prog
  • Issue the build/program command platformio run -e espwroom32 -t upload

When a stable firmware is installed, you'll find that esp-prog just works without any boot-strapping. However, sometimes you'll inadvertently leave the system in a bad state and the above procedure should be used.

ESP32-S3-DevKitM-1

This system uses esptool as can be seen with the line upload_protocol=esptool in the platformio.ini file. This board has a dedicated USB port for programming separate from the USB UART connection. To program follow these steps:

  • Connect the USB port to your host system (where you are running platformio)
  • On the target, press and hold down the BOOT button
  • Press reset button a couple times (you will see the built-in program stop as the WS2812 RGB LED will no longer blink)
  • System is now ready to be programmed via esptool
  • Issue the build/program command platformio run -e esp32-s3-devkitm-1 -t upload

Other ESP32-S3 Notes

Here is a good thread on debugging various ESP32 modules. Included is the reference schematic as found in the Espressif documentation and related notes.

Building for WROOM Modules

I have tested with several generations of the WROOM Module, with onboard and external antenna. Here is what a typical build and flash looks like with esp-prog connected to TMS, TDI, TDO, TCK, and GND.

 platformio run -e espwroom32 -t uploadProcessing espwroom32 (platform: espressif32; framework: arduino; board: esp32dev)
--------------------------------------------------------------------------------
Tool Manager: Installing espressif/toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: [email protected]+2021r2-patch3 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (5.2.0+sha.fee4b73) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20005.220925 (2.0.5) 
 - tool-esptoolpy @ 1.40400.0 (4.4.0) 
 - tool-mkfatfs @ 2.0.1 
 - tool-mklittlefs @ 1.203.210628 (2.3) 
 - tool-mkspiffs @ 2.230.0 (2.30) 
 - tool-openocd-esp32 @ 2.1100.20220706 (11.0) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 33 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Update @ 2.0.0
|-- WebServer @ 2.0.0
|   |-- WiFi @ 2.0.0
|   |-- FS @ 2.0.0
|-- EEPROM @ 2.0.0
|-- WiFi @ 2.0.0
|-- mavlink
Building in release mode
Compiling .pio/build/espwroom32/src/main.cpp.o
In file included from src/main.cpp:53:
/home/jfd/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/esp_event/include/esp_event_loop.h:2:2: warning: #warning "esp_event_loop.h is deprecated, please include esp_event.h instead" [-Wcpp]
 #warning "esp_event_loop.h is deprecated, please include esp_event.h instead"
  ^~~~~~~
Compiling .pio/build/espwroom32/src/mavesp8266.cpp.o
Compiling .pio/build/espwroom32/src/mavesp8266_component.cpp.o
Compiling .pio/build/espwroom32/src/mavesp8266_gcs.cpp.o
In file included from src/mavesp8266_gcs.cpp:44:
/home/jfd/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/tcpip_adapter/include/tcpip_adapter.h:15:2: warning: #warning "This header is deprecated, please use new network related API in esp_netif.h" [-Wcpp]
 #warning "This header is deprecated, please use new network related API in esp_netif.h"
  ^~~~~~~
Compiling .pio/build/espwroom32/src/mavesp8266_httpd.cpp.o
Compiling .pio/build/espwroom32/src/mavesp8266_parameters.cpp.o
Compiling .pio/build/espwroom32/src/mavesp8266_vehicle.cpp.o
Building .pio/build/espwroom32/bootloader.bin
esptool.py v4.4
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Generating partitions .pio/build/espwroom32/partitions.bin
Compiling .pio/build/espwroom32/lib064/Update/HttpsOTAUpdate.cpp.o
Compiling .pio/build/espwroom32/lib064/Update/Updater.cpp.o
Archiving .pio/build/espwroom32/lib064/libUpdate.a
Indexing .pio/build/espwroom32/lib064/libUpdate.a
Compiling .pio/build/espwroom32/lib005/WiFi/WiFi.cpp.o
Compiling .pio/build/espwroom32/lib005/WiFi/WiFiAP.cpp.o
Compiling .pio/build/espwroom32/lib005/WiFi/WiFiClient.cpp.o
Compiling .pio/build/espwroom32/lib005/WiFi/WiFiGeneric.cpp.o
Compiling .pio/build/espwroom32/lib005/WiFi/WiFiMulti.cpp.o
Compiling .pio/build/espwroom32/lib005/WiFi/WiFiSTA.cpp.o
Compiling .pio/build/espwroom32/lib005/WiFi/WiFiScan.cpp.o
Compiling .pio/build/espwroom32/lib005/WiFi/WiFiServer.cpp.o
Compiling .pio/build/espwroom32/lib005/WiFi/WiFiUdp.cpp.o
Archiving .pio/build/espwroom32/lib005/libWiFi.a
Indexing .pio/build/espwroom32/lib005/libWiFi.a
Compiling .pio/build/espwroom32/lib995/FS/FS.cpp.o
Compiling .pio/build/espwroom32/lib995/FS/vfs_api.cpp.o
Archiving .pio/build/espwroom32/lib995/libFS.a
Indexing .pio/build/espwroom32/lib995/libFS.a
Compiling .pio/build/espwroom32/libdca/WebServer/Parsing.cpp.o
Compiling .pio/build/espwroom32/libdca/WebServer/WebServer.cpp.o
Compiling .pio/build/espwroom32/libdca/WebServer/detail/mimetable.cpp.o
Archiving .pio/build/espwroom32/libdca/libWebServer.a
Indexing .pio/build/espwroom32/libdca/libWebServer.a
Compiling .pio/build/espwroom32/lib8cd/EEPROM/EEPROM.cpp.o
Archiving .pio/build/espwroom32/lib8cd/libEEPROM.a
Indexing .pio/build/espwroom32/lib8cd/libEEPROM.a
Compiling .pio/build/espwroom32/FrameworkArduino/Esp.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/FirmwareMSC.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/HWCDC.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/IPv6Address.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/MD5Builder.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/Print.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/StreamString.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/USB.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/USBCDC.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/USBMSC.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/WString.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/base64.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/cbuf.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-adc.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-bt.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-cpu.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-dac.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-gpio.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-i2c-slave.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-i2c.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-ledc.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-matrix.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-misc.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-psram.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-rgb-led.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-rmt.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-sigmadelta.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-spi.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-time.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-timer.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-tinyusb.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-touch.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/esp32-hal-uart.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/firmware_msc_fat.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/libb64/cdecode.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/libb64/cencode.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/main.cpp.o
Compiling .pio/build/espwroom32/FrameworkArduino/stdlib_noniso.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/wiring_pulse.c.o
Compiling .pio/build/espwroom32/FrameworkArduino/wiring_shift.c.o
Archiving .pio/build/espwroom32/libFrameworkArduino.a
Indexing .pio/build/espwroom32/libFrameworkArduino.a
Linking .pio/build/espwroom32/firmware.elf
Retrieving maximum program size .pio/build/espwroom32/firmware.elf
Checking size .pio/build/espwroom32/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  13.9% (used 45600 bytes from 327680 bytes)
Flash: [======    ]  61.7% (used 808153 bytes from 1310720 bytes)
Building .pio/build/espwroom32/firmware.bin
esptool.py v4.4
Creating esp32 image...
Merged 25 ELF sections
Successfully created esp32 image.
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esp-prog
Uploading .pio/build/espwroom32/firmware.bin
Open On-Chip Debugger  v0.11.0-esp32-20220706 (2022-07-06-15:48)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

adapter speed: 20000 kHz

WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
adapter speed: 5000 kHz

Warn : Not full dbg stub table 1 of 2
** Programming Started **
** Programming Finished in 9168 ms **
** Verify Started **
** Verify OK **
** Programming Started **
** Programming Finished in 1106 ms **
** Verify Started **
** Verify OK **
** Programming Started **
** Programming Finished in 781 ms **
** Verify Started **
** Verify OK **
** Programming Started **
** Programming Finished in 867 ms **
** Verify Started **
** Verify OK **
shutdown command invoked
======================== [SUCCESS] Took 610.78 seconds ========================

Environment    Status    Duration
-------------  --------  ------------
espwroom32     SUCCESS   00:10:10.776
========================= 1 succeeded in 00:10:10.776 =========================