2019-01-15 11:33 PM
How to interface SD card with STM32h743z1 nucleo borad ? Is there any working example? I generated code with cubeMx 5 and failed at the very first step.. I tried various threads regarding SD card and nothing helped me.
card initialization itself giving an error. While digging i noticed the program is looping arround a Delay(2);
Also when i measured the CLK at the SD card pin, it shows only 20Khz..
MY application is to store 12 Channel adc values in every sec (1sample per second).
2019-01-16 06:10 AM
Having things working here.
Considerations, good socket, with pull-ups, and uniform/short wiring.
Watch that you don't use overly aggressive edges (slew rate) for the IO pins.
Remove SB116/SB117 to eliminate stubs.
I would avoid writing small amounts to card repetitively, it is slow and creates excessive read-modify-write to the flash array.
Will see if I have a working demo to hand.
2019-01-16 11:16 AM
NUCLEO-H743ZI SDMMC Test Build
Outputs diagnostic via ST-LINK VCP at 115200 8N1
2019-01-16 10:56 PM
Thanks Clive,
I already Noticed/followed your recommendations. tried 10K/27K/47K pull ups, series 27Ohm resistors, removed SB116 and 117. tried Card with directly soldered Short wires and another one in Holder. Tried 1bit and 4bit. but The program is hanging in a HAL_Delay(2); .
However the same card and setup(1bit) works instantly with the SPI "FatFS_uSD_Standalone" application in nucleo FW and i can read/write /format etc.
Also i will transfer the data once in a minute or with block of 512 as per your advice.
2019-01-16 10:56 PM
Thanks Clive,
I already Noticed/followed your recommendations. tried 10K/27K/47K pull ups, series 27Ohm resistors, removed SB116 and 117. tried Card with directly soldered Short wires and another one in Holder. Tried 1bit and 4bit. but The program is hanging in a HAL_Delay(2); .
However the same card and setup(1bit) works instantly with the SPI "FatFS_uSD_Standalone" application in nucleo FW and i can read/write /format etc.
Also i will transfer the data once in a minute or with block of 512 as per your advice.
2019-01-16 11:32 PM
Thank you for the code.. i tested it and got the following results
Nucleo H743ZI
Core=400000000, 400 MHz
CPUID 411FC271 DEVID 450 REVID 1003
Cortex M7 r1p1
STM32H7xx
C0000038 24013780 00000000
10110221 12000011 00000040
FPU-D Single-precision and Double-precision
HCLK=200000000 APB1=100000000
APB2=100000000
FatFs Testing (68300)
Mounting FatFs
BSP_SD_MspInit
SD_PowerON Failed (HAL_SD_InitCard)
HAL_SD_InitCard Failed
HAL_SD_Init Failed
res = 3 f_getfree
PLL1_Q_CK=200000000, 200.00 MHz
PLL2_R_CK=0, 0.00 MHz
SDMMC_CK 250, 0.40 MHz
Infinite loop...
Nucleo H743ZI Core=400000000, 400 MHz
CPUID 411FC271 DEVID 450 REVID 1003
Cortex M7 r1p1
STM32H7xx C0000038 24013780 00000000 10110221 12000011 00000040
FPU-D Single-precision and Double-precision
HCLK=200000000 APB1=100000000 APB2=100000000
FatFs Testing (68300)
Mounting FatFs
BSP_SD_MspInit
CardInfo 15126528 512 512 ( 7.21 GB)
Nucleo H743ZI
Core=400000000, 400 MHz
CPUID 411FC271 DEVID 450 REVID 1003
Cortex M7 r1p1
STM32H7xx
C0000038 24013780 00000000
10110221 12000011 00000040
FPU-D Single-precision and Double-precision
HCLK=200000000 APB2=100000000
FatFs Testing (68300)
Mounting FatFs
BSP_SD_MspInit
CardInfo 7716864 512 512 ( 3.68 GB)
res = 3 f_getfree
PLL1_Q_CK=200000000, 200.00 MHz
PLL2_R_CK=0, 0.00 MHz
SDMMC_CK 2, 50.00 MHz
Infinite loop...
but there is no file action noticed in the card... may be not written
2019-01-17 06:34 AM
Presumably the cards are formatted/usable in a PC.
There is likely an issue with the wiring. I will make a slower and 1-bit variant.
The pin expectations are these
//
// NUCLEO-144 SDIO/SDMMC
// CN8
/// NC PC8 (D0)
// IOREF PC9 (D1)
// RESET PC10 (D2)
// (3V3) 3V3 PC11 (D3)
// 5V PC12 (CLK)
// (GND) GND PD2 (CMD)
// GND PG2 PF3 (CS)
// VIN PG3 PF5 (WP)
//
Using a WaveShare/ViewTool socket
https://www.waveshare.com/micro-sd-storage-board.htm
https://www.waveshare.com/SD-Storage-Board.htm
2019-01-17 06:44 AM
I'm not using CubeMX, I work more directly with HAL code, and code bases that span multiple STM32 families.
The pin configuration can either be in-line, in a BSP package, or in an MSP file for the project. In the MSP there is a callback for the SDIO/SDMMC initialization there should be code to enable clocks and set up pins, etc. Perhaps grep/search your source trees for GPIO_PIN_2.
I built a NUCLEO-144 BSP file for SDMMC support.
There should be assorted code examples under the HAL H7 trees in the repository. The EVAL board has more specific examples, but there should be stand-alone SDMMC examples, and ones in Applications/FatFs or Applications/Display, JPEG, etc using the cards. Use a File Manager or grep to search on "BSP_SD_Init"
2019-01-17 06:46 AM
Thread covering H7 SDMMC, cross linking so I can find it later. https://community.st.com/s/question/0D50X0000ADDM8DSQX/stm32h743-unreliable-micro-sd-transfers
2019-01-17 08:53 AM
25 MHz 1-bit and 4-bit modes