-
Notifications
You must be signed in to change notification settings - Fork 15
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
sd0: no SD/MMC card detected on F4DISCOVERY #3
Comments
Hello, and thank you for reporting your issue. Is 5v power and ground (detailed in your SD card board's user manual) supplied to the SD card board? diff --git a/sys/stm32/stm32f4xx_nucleo_sd.c b/sys/stm32/stm32f4xx_nucleo_sd.c
index cc8b213..607b392 100644
--- a/sys/stm32/stm32f4xx_nucleo_sd.c
+++ b/sys/stm32/stm32f4xx_nucleo_sd.c
@@ -107,7 +107,7 @@ SPIx_Init(void)
- SD card SPI interface max baudrate is 25MHz for write/read
- PCLK2 max frequency is 100 MHz
*/
- hnucleo_Spi.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
+ hnucleo_Spi.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4;
hnucleo_Spi.Init.Direction = SPI_DIRECTION_2LINES;
hnucleo_Spi.Init.CLKPhase = SPI_PHASE_2EDGE;
hnucleo_Spi.Init.CLKPolarity = SPI_POLARITY_HIGH; Recompile and flash the f4discovery kernel. Also, try different SD cards or MicroSD cards if your Lexar card isn't working. I test with various SanDisk MicroSD cards. Regards, |
Hello, thanks for your fast reply, Luc Hondareyte. |
I forgot the console message :) 2.11 BSD UNIX for STM32, rev G290 #13: Sun Mar 05 11:49:27 CET 2023 luc@unxbox:/home/luc/discobsd/sys/stm32/f4discovery cpu: STM32F407xx rev VGT6, 168 MHz, bus 48 MHz oscillator: phase-locked loop, clock source: high speed external uart2: pins tx=PA2/rx=PA3, af=7, console sd0: port spi2 sd0: type SDHC, size 2576384 kbytes sd0a: partition type b7, sector 2, size 102400 kbytes sd0b: partition type b8, sector 204802, size 2048 kbytes sd0c: partition type b7, sector 208898, size 102400 kbytes phys mem = 192 kbytes user mem = 96 kbytes root dev = (0,1) swap dev = (0,2) root size = 102400 kbytes swap size = 2048 kbytes Automatic boot in progress: starting file system checks. /dev/sd0a: 1452 files, 12015 used, 89984 free /dev/sd0c: 3 files, 3 used, 101996 free Updating motd... done Starting daemons: update cron Mon Jan 30 03:00:55 PST 2023 2.11 BSD UNIX (name.my.domain) (console) login: |
Hi again, Did your issue go away once you changed cards and fixed the wiring? Or did you also need the Prescaler diff? In case you are wondering, the SPI-based SD card driver is mainly the Adafruit driver for Nucleo boards that is bundled in STM32CubeF4. It may not yet have support for very new or very large cards. Running
Running
Thanks for supplying the dmesg / console messages. Regards |
Lightly tested this diff on a brand new STM32F407G-DISC1 board with the same SPI-based micro SD card setup as when I tested on an original version STM32F4DISCOVERY (so early that is has the silicon errata for MCU ID and revision ID) back in March. In my previous comment I had that same 32GB SD card working with the original STM32F4DISCOVERY using SPI and the STM32F412G-Disco (my main development board) using both SPI and SDIO. I am betting that the long wires to the SD card are causing a timing issue here. Or it could be too new to be supported by the SPI-based SD driver. More investigation is needed. I'm leaving this open until it gets solved, but in practice this issue gets solved by using a development board with an on-board micro SD card slot that is wired for SDIO, such as the STM32F412G-Disco1 or STM32F469I-Disco2. Regards. |
Hello,
On a F4DICOVERY, sd card is not detected, with this message:
I am using this adapter connected as follow:
The SD card is a lexar 16Go.
Any help will be apprecied.
The text was updated successfully, but these errors were encountered: