esp-hal icon indicating copy to clipboard operation
esp-hal copied to clipboard

esp-storage hangs entire device on write

Open sikora77 opened this issue 1 year ago • 4 comments

When I try to write to the FlashStorage the ESP32 hangs with no logs or panics regardless of write offset

sikora77 avatar Jun 24 '24 16:06 sikora77

Does the flash_read_write example (in-tree) work for you? Which exact dev-board/module/chip are you using? You need to make sure to use the release profile (ESP32 really, really shouldn't access flash during reading/writing).

bjoernQ avatar Jun 25 '24 06:06 bjoernQ

I am using an ESP32-WROOM-32, the exact chip is ESP32, the example doesn't work, it hangs after the read, saying the flash size is 4194304 and the read section is just "ff" 32 times. I am using the release profile

sikora77 avatar Jun 25 '24 09:06 sikora77

What does espflash board-info print?

bjoernQ avatar Jul 01 '24 13:07 bjoernQ

➜  ~ cargo espflash board-info
[2024-07-02T11:02:46Z INFO ] 🚀 A new version of cargo-espflash is available: v3.1.0
[2024-07-02T11:02:46Z INFO ] Serial port: '/dev/ttyUSB0'
[2024-07-02T11:02:46Z INFO ] Connecting...
[2024-07-02T11:02:47Z INFO ] Using flash stub
Chip type:         esp32 (revision v1.0)
Crystal frequency: 40MHz
Flash size:        4MB
Features:          WiFi, BT, Dual Core, 240MHz, Coding Scheme None
MAC address:       24:0a:c4:ee:02:e0

sikora77 avatar Jul 02 '24 11:07 sikora77

For some reason it stopped hanging, but writing to flash just doesn't work with the provided example code. This is the output:

Flash size = 4194304

Read from 9000:  [68, 65, 6c, 6c, 6f, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff]
Written to 9000: [69, 67, 6f, 70, 70, 01, 02, 03, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff]
Read from 9000:  [68, 65, 6c, 60, 60, 01, 02, 03, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff, ff]
Reset (CTRL-R in espflash) to re-read the persisted data.

sikora77 avatar Sep 04 '24 13:09 sikora77

@sikora77 can you attach the compiled binary, please? Just to try it on my side and have a look

bjoernQ avatar Sep 04 '24 13:09 bjoernQ

after playing around with reading the flash with esptool it started working as intented

sikora77 avatar Sep 04 '24 16:09 sikora77

I also encounter this issue. I have the same board and it sometimes randomly freezes on write. In my case this is linked to the second core. If I only use one core, everything works fine. The workload on the second core doesn't really matter. In my case it is just a print and a delay.

Flova avatar Feb 15 '25 16:02 Flova