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

chip_detect_error on ESP32-P4 #679

Open
mutatrum opened this issue Sep 12, 2024 · 4 comments · Fixed by #686
Open

chip_detect_error on ESP32-P4 #679

mutatrum opened this issue Sep 12, 2024 · 4 comments · Fixed by #686

Comments

@mutatrum
Copy link

When using espflash 3.1.1 on the P4 dev board, it fails to detect the chip:

$ espflash board-info
[2024-09-12T15:32:39Z INFO ] Serial port: '/dev/ttyUSB0'
[2024-09-12T15:32:39Z INFO ] Connecting...
[2024-09-12T15:32:39Z INFO ] Using flash stub
Error: espflash::chip_detect_error

  × Unrecognized magic value: 0xffffffff
  help: Supported chips are: esp32, esp32c2, esp32c3, esp32c6, esp32h2, esp32p4, esp32s2, esp32s3
        If your chip is supported, try hard-resetting the device and try again

Hard resetting results in the same error.

Flashing a C build with EPS-IDF works fine over the same ttyUSB0. Not sure which details can be provided that would help here.

@mutatrum
Copy link
Author

Addition: I got a different magic value, but only once?
Unrecognized magic value: 0x61632220

@mutatrum
Copy link
Author

It seems the magic value detection is no longer working for the P4:

We have recently found out that the magic number autodetection method is not reliable for ESP32-P4, as the value at the arbitrary address (CHIP_DETECT_MAGIC_REG_ADDR) can change between runs. Due to this, we are now considering changing the address (for all of the previous targets as well).

Fortunately, this is shouldn't be a big deal for P4, as autodetection based on the magic number is just a fallback method. The get_security_info method is primarily used and reliable.

espressif/esptool#1008 (comment)

@SergioGasquez
Copy link
Member

Thanks for sharing your findings! We are currently not very focused on P4, since its not yet on mass production. The P4 version that I have is quite old, and I was able to flash it with the magic value that we currently have. We would of course accept and appreciate any PR updating this!

@MabezDev
Copy link
Member

MabezDev commented Nov 9, 2024

I'm still seeing this on the latest v3.2.0 release:

mabez at mGentoo ➜ mabez RUST_LOG="info" espflash board-info
[2024-11-09T15:02:49Z INFO ] Serial port: '/dev/ttyUSB0'
[2024-11-09T15:02:49Z INFO ] Connecting...
[2024-11-09T15:02:50Z INFO ] Using flash stub
Error: espflash::chip_detect_error

  × Unrecognized magic value: 0xffffffff
  help: Supported chips are: esp32, esp32c2, esp32c3, esp32c6, esp32h2, esp32p4, esp32s2, esp32s3
        If your chip is supported, try hard-resetting the device and try again

mabez at mGentoo ➜ mabez RUST_LOG="info" espflash board-info
[2024-11-09T15:02:52Z INFO ] Serial port: '/dev/ttyUSB0'
[2024-11-09T15:02:52Z INFO ] Connecting...
[2024-11-09T15:02:52Z INFO ] Using flash stub
Error: espflash::chip_detect_error

  × Unrecognized magic value: 0xffffffff
  help: Supported chips are: esp32, esp32c2, esp32c3, esp32c6, esp32h2, esp32p4, esp32s2, esp32s3
        If your chip is supported, try hard-resetting the device and try again

mabez at mGentoo ➜ mabez RUST_LOG="info" espflash board-info
[2024-11-09T15:02:53Z INFO ] Serial port: '/dev/ttyUSB0'
[2024-11-09T15:02:53Z INFO ] Connecting...
[2024-11-09T15:02:54Z INFO ] Using flash stub
Chip type:         esp32p4 (revision v0.0)
Crystal frequency: 40 MHz
Flash size:        4MB
Features:          High-Performance MCU
MAC address:       60:55:f9:f8:81:2d

Three runs in a row, two failed and one succeeded.

I think the full solution (and what they use in esptool) is to use get_security_info to get the image chip ID which is unique for each chip: https://github.com/espressif/esptool/blob/ab2e0bf8d69813333e43bb54203a9833150200e3/esptool/targets/esp32p4.py#L16

I only have a rev1 p4 board, so it's unclear to me if this is fixed in later revisions but if esptool are using this method as there primary chip detection tool, we probably should too?

Reopening.

@MabezDev MabezDev reopened this Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants