Hello!
I'm quite new to Rust generally, so apologies if I'm missing something obvious.
I'm trying to use the example code to mount an SD Card on an M5 Cardputer. I've changed the pins to match the board as follows:
[Codebox]
let spi_driver = SpiDriver::new(
peripherals.spi3,
pins.gpio40,
pins.gpio14,
Some(pins.gpio39),
&DriverConfig::default().dma(Dma::Auto(1024)),
)?;
let spi_device = SpiDevice::new(
spi_driver,
pins.gpio12,
[/Codebox]
When I try to run the code on device I get the following when [Codebox]Fat::mount[/Codebox] is called:
[Codebox]
I (446) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (446) sdspi_transaction: cmd=52, R1 response: command not supported
I (496) sdspi_transaction: cmd=5, R1 response: command not supported
E (506) vfs_fat_sdmmc: mount_to_vfs failed (0x102).
I (506) gpio: GPIO[12]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (516) gpio: GPIO[14]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (526) gpio: GPIO[39]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (536) gpio: GPIO[40]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
thread 'main' panicked at /home/benvh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-idf-hal-0.44.1/src/spi.rs:482:52:
called `Result::unwrap()` on an `Err` value: ESP_ERR_INVALID_STATE (error code 259)
[/Codebox]
I haven't been able to figure out anything that is obviously wrong, so I'm asking for help. It looks like the GPIOs might not be in the right state (OutputEn: 0) but I'm not sure if that's correct or not and the example code doesn't reconfigure the pins manually.
I don't have another ESP board with an SD card with me at the moment, so I'm trying to figure out why it's failing. I've tried setting [Codebox]format_if_mount_failed[/Codebox] when calling [Codebox]Fat::mount[/Codebox] but it didn't make any difference.
Thanks for any pointers or thoughts!
esp-idf-svc 0.49.1 spi sdcard example failing to mount
-
- Posts: 2
- Joined: Mon Nov 04, 2024 3:56 pm
-
- Posts: 2
- Joined: Mon Nov 04, 2024 3:56 pm
Re: esp-idf-svc 0.49.1 spi sdcard example failing to mount
I've made a little progress here.
I've found that changing the mount point from / to /sdcard gets me further, but now I've got a panic from deep in the esp-idf about not all CSes being freed.
[Codebox]
Mounting FAT filesystem...
I (449) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (449) sdspi_transaction: cmd=52, R1 response: command not supported
I (499) sdspi_transaction: cmd=5, R1 response: command not supported
E (519) spi_master: spi_master_deinit_driver(309): not all CSses freed
I (519) gpio: GPIO[14]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (529) gpio: GPIO[39]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (539) gpio: GPIO[40]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
assert failed: spi_bus_deinit_lock spi_bus_lock.c:594 (atomic_load(&lock->dev) == (intptr_t)NULL)
[/Codebox]
I've found that changing the mount point from / to /sdcard gets me further, but now I've got a panic from deep in the esp-idf about not all CSes being freed.
[Codebox]
Mounting FAT filesystem...
I (449) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (449) sdspi_transaction: cmd=52, R1 response: command not supported
I (499) sdspi_transaction: cmd=5, R1 response: command not supported
E (519) spi_master: spi_master_deinit_driver(309): not all CSses freed
I (519) gpio: GPIO[14]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (529) gpio: GPIO[39]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (539) gpio: GPIO[40]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
assert failed: spi_bus_deinit_lock spi_bus_lock.c:594 (atomic_load(&lock->dev) == (intptr_t)NULL)
[/Codebox]
Who is online
Users browsing this forum: No registered users and 9 guests