Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notes on getting started #227

Open
anthonyjclark opened this issue Mar 6, 2024 · 3 comments
Open

Notes on getting started #227

anthonyjclark opened this issue Mar 6, 2024 · 3 comments

Comments

@anthonyjclark
Copy link

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
    1. create a new directory
    2. npm init
    3. npm install --save-dev assemblyscript
    4. npm install 'https://gitpkg.now.sh/TOPLLab/WARDuino-libs/glue/assemblyscript?main' (will be replaced by npm install as-warduino)
    5. npx asinit .
    6. assembly/index.ts (I copied over the Blink example and changed the LED to the internal LED for my board)
    7. npm run asbuild
  • arduino-cli steps
    1. arduino-cli config init
    2. arduino-cli config dump --verbose
    3. 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)
    4. arduino-cli core update-index
    5. arduino-cli core install esp32:esp32
    6. arduino-cli lib install PubSubClient
    7. arduino-cli lib install "Adafruit NeoPixel"
    8. cd ~/Documents/Arduino/libraries (this is the default path on macos)
    9. git clone git@github.com:TOPLLab/WARDuino.git
    10. cd WARDuino
    11. git submodule update --init (needed to fetch the json library submodule)
  • compile and upload steps
    1. cd ~/Documents/Arduino/libraries/WARDuino/platforms/Arduino
    2. 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)
    3. 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.

@anthonyjclark
Copy link
Author

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

@anthonyjclark
Copy link
Author

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!

@anthonyjclark
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant