cancel
Showing results for 
Search instead for 
Did you mean: 

Can't resolve issue with STM32H7 using SDMMC and micro SD card

MPatt.11.286
Associate II

I am completely baffled by an issue I’m having with the STM32H7 using the SDMMC and a micro SD card. I have the F7 working and two H7 platforms that both have the same data timeout problem.

The STM32F767ZI Nucleo board working OK with the SDMMC and a micro SD card connected to the Nucleo with a breakout board connected to the IO pins. I have run it successfully in the D0 pin and the D0-D3 pin configurations. I used the STM32F767ZI-Nucleo Project and the FatFs example that ST provides as part of the STM32CubeF7-master.

I am using STM32H743ZI Nucleo board with the firmware from the STM32CubeH7-master, for the NUCLEO-H743ZI. Since I am not using the Adafruit adapter for the SD card, I used the stm32h743i_eval_sd.c from the STM32H743I-EVAL project and set _USE_IOCTL to 0 since I am not using the SD Card IO level shifters. I changed the card detect to properly detect my card.

The SD card is connected directly to the same pins on both Nucleo cards, which is the STMMC1 controller on both the F7 and H7 processors.

The F7 board came right up and worked, while the H7 board device did not. 

The H7 is initializing the SD card OK. I can see commands and responses going back and forth between the CPU and the SD card on the CMD line with a logic analyzer. It fails with a data timeout the first time the response from the SD Card is supposed to come back from the SD card on the D0 line. This happens in the HAL_SD_ReadBlocks routine.

At this point in the initialization the clock speed is only 400 KHz, and the timeout is waiting at >1 second for a response, which never comes.

I am sure the SD card adapter is working because I have successfully used the same adapter on the F7.  I’ve checked connectivity between the pins on the adapter board to the Nucleo board with a DVM.

I believe the issue is somewhere in the initialization software. I say this because I have custom board with a STM32H743VIT6 (same part in a 100-pin package) with a SD card connected to the same logical pins and I am seeing the same exact problem with the data timeout in the same spot in the code.

I’ve been trying to debug this problem for a week and I am no closer to resolving it. I know people on this forum have been able to get the STM32H743ZI Nucleo board to work with a SD card. Since this fails on two different hardware platforms, I have to believe there is something is wrong in the firmware.

Here are more things that I’ve done in debugging:

·       _USE_IOCTL = 0 to disable the code for the level shifter

·       Read the Errata sheet for possible issues

·       Ported the working F7 code to the H7 and replaced the specific H7 code. Ran into the same problem.

·       Checked voltages and noise on the SD card. All looked OK.

·       Tried faster and slower clock speeds to the SD card. This did not make any difference.

·       Tried 1-bit vs 4-bit configuration. No difference.

·       Rebuilt all of the code from the examples 2 more times in case I missed something – still the same issue.

Does anyone have any ideas what may be wrong?

I have seen where some people on the forum have this working on the H7. I would be extremely appreciative if someone could share the code they have working for SD Card if it uses the SDIO and not the SPI bus. I need to use SDIO since my board is already built.

Sorry for the long post. I wanted to provide all of the background information.

10 REPLIES 10

Always good to have some working SW or HW to pivot from.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..