probe-rs: flash fail on esp32-c3

Describe the bug

I can’t flash an esp32-c3 with probe-rs 0.22.0 (and --features cli,ftdi) on 2 different setups. I’m not sure if this is the same issue or not.

To Reproduce, case 1

In this case, I am using a esp32-c3-devkit-RUST-1 v1.2a, so with only one USB cable I have a working JTAG

  1. clone https://github.com/esp-rs/esp-hal, and go in esp32c3-hal subdir
  2. set runner = "probe-rs run --chip esp32c3" in .cargo/config.toml (ref. doc)
  3. cargo run --example blinky --release
   Compiling esp32c3-hal v0.14.0 (…/esp-hal/esp32c3-hal)
    Finished release [optimized + debuginfo] target(s) in 0.22s
     Running `probe-rs run --chip esp32c3 target/riscv32imc-unknown-none-elf/release/examples/blinky`
      Erasing ⠁ [00:00:00] [-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]      0 B/     0 B @      0 B/s (eta 0s )Error: The flashing procedure failed for 'target/riscv32imc-unknown-none-elf/release/examples/blinky'.

Caused by:
    0: Something during the interaction with the core went wrong
    1: An error with the usage of the probe occurred
    2: USB Communication Error
    3: Operation timed out

(this was initially reported in https://github.com/esp-rs/esp-hal/issues/1060, and was reproduced by @bjoernQ )

To Reproduce, case 2

In this case, I am using a esp32-C3-devkitC-02v1.1 (without USB-JTAG), and a ST-link v2, and with the same steps I get:

   Compiling esp32c3-hal v0.14.0 (/home/nim/local/esp-rs/esp-hal/esp32c3-hal)
    Finished release [optimized + debuginfo] target(s) in 0.22s
     Running `probe-rs run --chip esp32c3 target/riscv32imc-unknown-none-elf/release/examples/blinky`
Error: Connecting to the chip was unsuccessful.

Caused by:
    0: An error with the usage of the probe occurred
    1: An error specific to a probe type occurred
    2: Command failed with status JtagGetIdcodeError

(this was initially reported in https://github.com/esp-rs/esp-hal/issues/1061)

Expected behavior

esp32-c3 should be flashed

Desktop (please complete the following information):

Arch

Additional context, case 1

  • dmesg
[ 2087.030094] usb 1-6.4.4.2: new full-speed USB device number 39 using xhci_hcd
[ 2087.154933] usb 1-6.4.4.2: New USB device found, idVendor=303a, idProduct=1001, bcdDevice= 1.01
[ 2087.154948] usb 1-6.4.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2087.154955] usb 1-6.4.4.2: Product: USB JTAG/serial debug unit
[ 2087.154960] usb 1-6.4.4.2: Manufacturer: Espressif
[ 2087.154965] usb 1-6.4.4.2: SerialNumber: 60:55:F9:BC:45:2C
[ 2087.168153] cdc_acm 1-6.4.4.2:1.0: ttyACM0: USB ACM device
  • probe-rs list
The following debug probes were found:
[0]: ESP JTAG (VID: 303a, PID: 1001, Serial: 60:55:F9:BC:45:2C, EspJtag)
  • probe-rs info
Probing target via JTAG

No DAP interface was found on the connected probe. Thus, ARM info cannot be printed.
RISC-V Chip:
	IDCODE: 0000005c25
	Version:      0
	Part:         5
	Manufacturer: 1554 (Espressif Systems (Shanghai)  Co Ltd)

Probing target via SWD

Error identifying target using protocol SWD: Probe does not support SWD

Additional context, case 2

  • Connections
FTDI esp32-c3 st-link v2
TMS 4 7
TDI 5 5
TCK 6 9
TDO 7 13

ref. https://www.st.com/resource/en/user_manual/um1075-stlinkv2-incircuit-debuggerprogrammer-for-stm8-and-stm32-stmicroelectronics.pdf ref. https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/api-guides/jtag-debugging/configure-other-jtag.html

  • dmesg for esp32-c3
[ 3545.410960] usb 1-6.4.4.3: new full-speed USB device number 46 using xhci_hcd
[ 3545.526853] usb 1-6.4.4.3: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00
[ 3545.526868] usb 1-6.4.4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3545.526875] usb 1-6.4.4.3: Product: CP2102N USB to UART Bridge Controller
[ 3545.526880] usb 1-6.4.4.3: Manufacturer: Silicon Labs
[ 3545.526885] usb 1-6.4.4.3: SerialNumber: d6d63185e0a0eb11b5a5cdacdf749906
[ 3545.532726] cp210x 1-6.4.4.3:1.0: cp210x converter detected
[ 3545.535637] usb 1-6.4.4.3: cp210x converter now attached to ttyUSB0
  • dmesg for st-link v2
[ 3567.154350] usb 1-6.4.4.1: new full-speed USB device number 47 using xhci_hcd
[ 3567.276142] usb 1-6.4.4.1: New USB device found, idVendor=0483, idProduct=3748, bcdDevice= 1.00
[ 3567.276158] usb 1-6.4.4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3567.276165] usb 1-6.4.4.1: Product: STM32 STLink
[ 3567.276170] usb 1-6.4.4.1: Manufacturer: STMicroelectronics
[ 3567.276175] usb 1-6.4.4.1: SerialNumber: 6ÿn\x06BF127\x15\x13W
  • probe-rs list
The following debug probes were found:
[0]: STLink V2 (VID: 0483, PID: 3748, Serial: 36C3BF6E064246313237151357, StLink)
  • probe-rs info
Probing target via JTAG

Error identifying target using protocol JTAG: An error with the usage of the probe occurred

Probing target via SWD

Error identifying target using protocol SWD: An error with the usage of the probe occurred

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 22 (17 by maintainers)

Most upvoted comments

Glad to hear it is working though!

Me too. I thought I was going to have to buy a new dev kit … except DigiKey Canada sells them with a minimum order quantity of 240 units (Cdn$ 6760.89) … ROTFL

FYI https://github.com/probe-rs/probe-rs/pull/2173 has fixed the index out of range issue on a cold start up of the espusbjtag probe.

That said, first I had to run into … thread ‘main’ panicked at probe-rs/src/probe/espusbjtag/protocol.rs:152:38: index out of bounds: the len is 0 but the index is 0 … a few times. The good news, it is reproduce-able if you set speed 24000 on your connection.

I’ve run into that too, it looks like an nusb issue/difference - I should be able to solve that too. Glad to hear it is working though!

This one is still broken for me

stlink is swd only, so you won’t be able to flash a esp with that, so I will ignore case 2 here.

As for using the usb-serial-jtag on the esp32c3, its working for me?

Could you try holding the boot pin down whilst plugging in the USB? If the board is resetting because of the previously flashed application fast enough, the usb-serial-jtag device can reset too. Putting it into download mode should stop that behavior.