Skip to content

Embassy playground for ESP32-{C3|C6} chips

Notifications You must be signed in to change notification settings

akauppi/Embassy-playground-2024

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Embassy Playground 2024

Using Embassy on ESP32-C3 and C6 targets, in 2024.

Background

Based on jessebraham/esp-hal-template, but:

  • supports stable in addition to nightly toolchain
  • not a template repo, but a normal one

The idea is to support two kinds of targets:

Requirements

Follow ESP32-Mac to set up:

  • Multipass

  • rust-emb VM

    Please update probe-rs to an upcoming (> 0.24.0) version. Otherwise, only works on esp32c6 chips.

     $ cargo install --git https://github.com/probe-rs/probe-rs probe-rs-tools --force
    

Build and run (stable)

For esp32c3, use riscv32imc-unknown-none-elf and esp32c3.

$ cargo build --release --features=esp32c6 --target=riscv32imac-unknown-none-elf
$ probe-rs run --chip esp32c6 target/riscv32imac-unknown-none-elf/release/app

..with nightly (optional)

$ cargo +nightly-2024-06-01 run --features nightly,esp32c6 --release --target=riscv32imac-unknown-none-elf

Note: For the moment, one needs to have nightly < 2024-06-13 (or perhaps the patch for embassy-executor-macros). source

Running as above.

Additional

About "task arena" size

See embassy-executor > Task arena documentation.

TL;DR:

  • nightly would be better. No need to provide an intended "task arena size".
  • On stable, one can do that in a couple of ways (but it's presumably optional).

Troubleshooting

USB errors

If you get USB errors:

Caused by:
    0: USB Communication Error
  • reset the devkit by:

    • pushing both RST and BOOT buttons
    • release the RST button
    • then release BOOT button
  • reconnect the USB/IP connection:

    • RPi: usbipd bind -b 1-1.2
    • VM: usbip attach -r 192.168.1.199 -b 1-1.2

    Obviously, you'll need to use the IP and bus-id that apply to your system.

    There are ways to make a board automatically rebind on the host side; this is not covered here. Windows usbipd seems to rebind automatically.

  • and try again.

Sample error case
$ make run
probe-rs run --chip esp32c6 target/riscv32imac-unknown-none-elf/release/app
      Erasing ✔ [00:00:01] [###############################################################################################################] 128.00 KiB/128.00 KiB @ 71.85 KiB/s (eta 0s )
  Programming ✔ [00:00:12] [##################################################################################################################] 26.10 KiB/26.10 KiB @ 2.12 KiB/s (eta 0s )    Finished in 15.477s
INFO  RWDT watchdog enabled!
└─ app::____embassy_main_task::{async_fn#0} @ src/bin/app.rs:47  
ERROR !! A panic occured in '/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-hal-embassy-0.2.0/src/time_driver/mod.rs', at line 102, column 42:
└─ esp_backtrace::panic_handler @ /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-backtrace-0.13.0/src/lib.rs:29  
ERROR "panicked at /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-hal-embassy-0.2.0/src/time_driver/mod.rs:102:42:\ncalled `Option::unwrap()` on a `None` value"
└─ esp_backtrace::panic_handler @ /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-backtrace-0.13.0/src/lib.rs:29  
ERROR Backtrace:
└─ esp_backtrace::panic_handler @ /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-backtrace-0.13.0/src/lib.rs:29  
ERROR No backtrace available - make sure to force frame-pointers. (see https://crates.io/crates/esp-backtrace)
└─ esp_backtrace::panic_handler @ /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-backtrace-0.13.0/src/lib.rs:29  
 WARN probe_rs::session: Could not clear all hardware breakpoints: An error with the usage of the probe occurred

Caused by:
    0: USB Communication Error
    1: endpoint STALL condition
thread 'main' panicked at probe-rs/src/probe/espusbjtag/protocol.rs:375:37:
range end index 77 out of range for slice of length 64
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
make: *** [Makefile:53: run] Error 101

Remote USB/IP not listed

$ usbip list -r 192.168.1.199
usbip: info: no exportable devices found on 192.168.1.199
  • Reset the board as instructed above (both buttons; release RST; release BOOT).

  • RPi:

     $ sudo usbip bind -b 1-1.2
    
  • VM:

     $ usbip list -r 192.168.1.199
     Exportable USB devices
     ======================
      - 192.168.1.199
           1-1.2: unknown vendor : unknown product (303a:1001)
                : /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2
                : Miscellaneous Device / ? / Interface Association (ef/02/01)
    

That's it.

About

Embassy playground for ESP32-{C3|C6} chips

Resources

Stars

Watchers

Forks