esp-rs / espflash

Serial flasher utility for Espressif SoCs and modules based on esptool.py
Apache License 2.0
455 stars 110 forks source link

Arduino UNO R4 WiFi - ESP32-S3 Not connecting #640

Closed MarcusWentz closed 1 month ago

MarcusWentz commented 1 month ago

When I run:

espflash board-info

I get the following error:

[2024-05-25T11:39:02Z INFO ] Serial port: '/dev/ttyACM1'
[2024-05-25T11:39:02Z INFO ] Connecting...
Error: espflash::connection_failed

  × Error while connecting to device
  ╰─▶ Failed to connect to the device
  help: Ensure that the device is connected and the reset and boot pins are not being held down

Checking espflash version:

espflash --version

returns:

espflash 3.0.0

I tried switching connected ports but I get the same error log.

I am following this Rust ESP32 tutorial:

https://www.youtube.com/watch?v=vUSHaogHs1s&list=PLkch9g9DEE0Lkm1LqcD7pZNDmXEczOo-a

With GitHub link:

https://github.com/shanemmattner/ESP32-C3_Rust_Tutorials/tree/main

Seems related to:

https://github.com/esp-rs/espflash/issues/534

@SergioGasquez what might be causing this? It sounded like a pin needed to be shorted for the Arduino Nano issue linked above.

MarcusWentz commented 1 month ago

I tried to install espflash this way now:

cargo install espflash --git https://github.com/esp-rs/espflash

as suggested here:

https://github.com/esp-rs/espflash/issues/534#issuecomment-1869052278

Now running:

espflash --version

now returns:

espflash 3.0.1-dev

However, when I run:

espflash board-info

I get the same error log:

[2024-05-25T11:39:02Z INFO ] Serial port: '/dev/ttyACM1'
[2024-05-25T11:39:02Z INFO ] Connecting...
Error: espflash::connection_failed

  × Error while connecting to device
  ╰─▶ Failed to connect to the device
  help: Ensure that the device is connected and the reset and boot pins are not being held down
Vollbrecht commented 1 month ago

if you look into the schematic of your board, it seams that the esp32s3 and the Renesas R7FA4M1AB3CFM are connected in "parallel" on the same two usb lines going out from the connector without a proper usb-hub in between. I don't know how arudino code handels it all but just from a practical point i could see that this might create problems if the Renesas chip is also trying to act on the bus at the same time. So i would try to hold the Renesas chip into a reset state if that is possible while acting on the esp32s3.

MarcusWentz commented 1 month ago

Yes I have heard controversy regarding having both devices on the same board. I am not sure how Arduino handles this either. I tried flashing while clicking and holding the RESET button, but no luck.

I have been running robotics and internet Rust projects on a Raspberry Pi 4, since it acts like a computer with GPIO pins. I have been curious to try Rust robotics and internet development on Arduino hardware.

Maybe I should consider using a simpler board like a Arduino Nano ESP32-S3 since this same issue looked resolved?

Vollbrecht commented 1 month ago

one thing you can do if you didn't try is using espflash board-info --no-stub also espflash has additional arguments around resets, regarding pre and post resets after a command is run, You can check all commands for each subcommand by espflash <command> help e,g espflash board-info help

MarcusWentz commented 1 month ago

I tried again with the no stub flag (Do not use the RAM stub for loading)

espflash board-info --no-stub

but the error still exists.

Should we close this issue since espflash is focused on ESP32 development and the Renesas R7FA4M1AB3CFM (RA4M1) seems out of scope? I might just get a Arduino Nano ESP32-S3 instead to keep things simple.

SergioGasquez commented 1 month ago

Hi! As mentioned before, its probably due to the fact that there are 2 devices on the same board, I'm curious if esptool works, and how they solve this issue. AFAIK, Arduino IDE uses esptool under the hood, could you try flashing with esptool (https://github.com/espressif/esptool/)?

MarcusWentz commented 1 month ago

I downloaded esptool with:

pip install esptool

when I run:

esptool.py version

I get

esptool.py v4.7.0
4.7.0

Is there a command for getting all ESP32 connected devices like

espflash board-info

?

esptool documentation:

https://docs.espressif.com/projects/esptool/en/latest/esp32/#quick-start

MarcusWentz commented 1 month ago

When I run:

esptool.py chip_id

I get the following errors:

esptool.py v4.7.0
Found 2 serial ports
Serial port /dev/ttyACM1
Connecting......................................
/dev/ttyACM1 failed to connect: Failed to connect to Espressif device: No serial data received.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
Serial port /dev/ttyACM0
Connecting......................................
/dev/ttyACM0 failed to connect: Failed to connect to Espressif device: No serial data received.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html

A fatal error occurred: Could not connect to an Espressif device on any of the 2 available serial ports.

I think I will just try out a regular ESP32 board to keep things simple. Should we close this issue for now?

SergioGasquez commented 1 month ago

Looks like esptool also encounters the same issue, so I would guess this is a hardware thing and there is not much that we can do.

Please, feel free to try with a regular devkit!