Notes on getting started
The summary is that I was unable to upload a WARDuino sketch to my Adafruit ESP32 Feather V2 using the arduino-cli. I still need to try uploading the the sketch using the VSCode Arduino extension or Arduino Studio.
Here are my notes (some are relevant to the Getting Started page but many are only relevant to a developer trying to get started now before WARDuino is ready):
- The following dependencies should be installed before starting:
- node and npm
- arduino-cli
- I'd add a blinking light program to the getting started page so that someone has a flashed example completed when they are done.
- AssemblyScript steps
- create a new directory
-
npm init -
npm install --save-dev assemblyscript -
npm install 'https://gitpkg.now.sh/TOPLLab/WARDuino-libs/glue/assemblyscript?main'(will be replaced bynpm install as-warduino) -
npx asinit . -
assembly/index.ts(I copied over the Blink example and changed the LED to the internal LED for my board) -
npm run asbuild
- arduino-cli steps
-
arduino-cli config init -
arduino-cli config dump --verbose - Add board manager to the config file (note: I had to switch to Stable release link so that I installed a compatible version of the ESP32 board manager)
-
arduino-cli core update-index -
arduino-cli core install esp32:esp32 -
arduino-cli lib install PubSubClient -
arduino-cli lib install "Adafruit NeoPixel" -
cd ~/Documents/Arduino/libraries(this is the default path on macos) -
git clone [email protected]:TOPLLab/WARDuino.git -
cd WARDuino -
git submodule update --init(needed to fetch the json library submodule)
-
- compile and upload steps
-
cd ~/Documents/Arduino/libraries/WARDuino/platforms/Arduino -
make compile BINARY=path/to/assemblyscript/directory/build/release.wasm FQBN=esp32:esp32:adafruit_feather_esp32_v2 PORT=/dev/tty.usbserial-555F0646821 PAUSED=true(only some options are needed here) -
make flash BINARY=path/to/assemblyscript/directory/build/release.wasm FQBN=esp32:esp32:adafruit_feather_esp32_v2 PORT=/dev/tty.usbserial-555F0646821 PAUSED=true(only some options are needed here)
-
My upload fails. Here is the output:
❯ make flash BINARY=$HOME/Documents/Repositories/warduino-test/build/release.wasm FQBN=esp32:esp32:adafruit_feather_esp32_v2 PORT=/dev/tty.usbserial-555F0646821 PAUSED=true
arduino-cli upload -p /dev/tty.usbserial-555F0646821 --fqbn esp32:esp32:adafruit_feather_esp32_v2 Arduino.ino
esptool.py v4.5.1
Serial port /dev/tty.usbserial-555F0646821
Connecting............
Chip is ESP32-PICO-V3-02 (revision v3.0)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, Embedded PSRAM, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 0c:8b:95:94:5a:30
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
A fatal error occurred: Unable to verify flash chip connection (Packet content transfer stopped (received 6 bytes)).
Failed uploading: uploading error: exit status 2
make: *** [Makefile:39: flash] Error 1
I am pretty certain this is an issue with the upload speed and this particular board. I will try uploading it using the VS Code extension next.
I mentioned the migration from board manager version 2 to 3 during our discussion. Here is the migration guide: Migration from 2.x to 3.0 - - — Arduino ESP32 latest documentation
The sketch successfully uploads using the VSCode extension:
---- Opened the serial port /dev/tty.usbserial-555F0646821 ----
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 271414342, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13260
load:0x40080400,len:3028
entry 0x400805e4
283420
Total heap:
311616
Free heap:
283420
Total PSRAM:
2095103
Free PSRAM:
2095103
LOADED
START
Free heap:
267560
received interrupt 3
Interrupt: 3
PAUSE!
I discovered the correct option name! We were trying baud and baudrate. We should have been using UploadSpeed.
I ran the following command to find this out: arduino-cli board details -b esp32:esp32:adafruit_feather_esp32_v2
This spits out a bunch of information:
Board name: Adafruit Feather ESP32 V2
FQBN: esp32:esp32:adafruit_feather_esp32_v2
Board version: 2.0.14
Package name: esp32
Package maintainer: Espressif Systems
Package URL: https://espressif.github.io/arduino-esp32/package_esp32_index.json
Package website: https://github.com/espressif/arduino-esp32
Package online help: http://esp32.com
Platform name: esp32
Platform category: ESP32
Platform architecture: esp32
Platform URL: https://github.com/espressif/arduino-esp32/releases/download/2.0.14/esp32-2.0.14.zip
Platform file name: esp32-2.0.14.zip
Platform size (bytes): 252506057
Platform checksum: SHA-256:77c71eba520c97ab30161eb2f9c6a46b019e48d13936244b18f6ad4dbecf0a58
Required tool: arduino:dfu-util 0.11.0-arduino5
Required tool: esp32:esptool_py 4.5.1
Required tool: esp32:mklittlefs 3.0.0-gnu12-dc7f933
Required tool: esp32:mkspiffs 0.2.3
Required tool: esp32:openocd-esp32 v0.12.0-esp32-20230419
Required tool: esp32:riscv32-esp-elf-gcc esp-2021r2-patch5-8.4.0
Required tool: esp32:riscv32-esp-elf-gdb 11.2_20220823
Required tool: esp32:xtensa-esp-elf-gdb 11.2_20220823
Required tool: esp32:xtensa-esp32-elf-gcc esp-2021r2-patch5-8.4.0
Required tool: esp32:xtensa-esp32s2-elf-gcc esp-2021r2-patch5-8.4.0
Required tool: esp32:xtensa-esp32s3-elf-gcc esp-2021r2-patch5-8.4.0
Option: Upload Speed UploadSpeed
921600 ✔ UploadSpeed=921600
115200 UploadSpeed=115200
230400 UploadSpeed=230400
460800 UploadSpeed=460800
Option: CPU Frequency CPUFreq
240MHz (WiFi/BT) ✔ CPUFreq=240
160MHz (WiFi/BT) CPUFreq=160
80MHz (WiFi/BT) CPUFreq=80
40MHz CPUFreq=40
20MHz CPUFreq=20
10MHz CPUFreq=10
Option: Flash Frequency FlashFreq
80MHz ✔ FlashFreq=80
40MHz FlashFreq=40
Option: Flash Size FlashSize
8MB (64Mb) ✔ FlashSize=8M
Option: Partition Scheme PartitionScheme
Default (3MB APP/1.5MB SPIFFS) ✔ PartitionScheme=default_8MB
Option: Core Debug Level DebugLevel
None ✔ DebugLevel=none
Error DebugLevel=error
Warn DebugLevel=warn
Info DebugLevel=info
Debug DebugLevel=debug
Verbose DebugLevel=verbose
Option: PSRAM PSRAM
Enabled ✔ PSRAM=enabled
Disabled PSRAM=disabled
Option: Arduino Runs On LoopCore
Core 1 ✔ LoopCore=1
Core 0 LoopCore=0
Option: Events Run On EventsCore
Core 1 ✔ EventsCore=1
Core 0 EventsCore=0
Option: Erase All Flash Before Sketch Upload EraseFlash
Disabled ✔ EraseFlash=none
Enabled EraseFlash=all
Programmers: ID Name
esptool Esptool
The following flash command works now: make flash BINARY=$HOME/Documents/Repositories/warduino-test/build/release.wasm FQBN=esp32:esp32:adafruit_feather_esp32_v2:UploadSpeed=115200 PORT=/dev/tty.usbserial-555F0646821 PAUSED=true