cancel
Showing results for 
Search instead for 
Did you mean: 

STM32h745 sdmmc f_mount returns FR_NOT_READY

Rde c.1969
Associate

Hi everyone,

I know this question has many topics related on the forum but I can't find the solution to my problem. I'm working with a NUCLEO-H745ZI-Q:

I am using sdmmc in 1bit mode for now (the module I have only supports 1bit mode):

I installed 10k pull-up resistors on DI and D0.

when I use f_mount() it returns FR_NOT_READY. the card detect pin is plugged and configured in FATFS in cubeMX.

Since I have a 32GB card I wanted to enable _FS_EXFAT and _USE_LFN but this returns 2 errors on compilation:

sd_nucleo_CM7\sd_nucleo_CM7.axf: Error: L6218E: Undefined symbol ff_convert (referred from ff.o).

sd_nucleo_CM7\sd_nucleo_CM7.axf: Error: L6218E: Undefined symbol ff_wtoupper (referred from ff.o).

can't find these functions in fatfs library

another problem, my sdmmc clock it set up to work at 10MHz (20MHz in clock config, with a divider set up at 1). if I measure this clock with a scope I can see it runs at 40kHz.

I believe this may be the root of all my problems

I am completely lost, I don't know anymore what I should do, any help would be appreciated =)

Have a nice day

2 REPLIES 2

Posted to the wrong sub-forum.

Aren't those functions provided? Use grep

STM32Cube_FW_H7_V1.4.0\Middlewares\Third_Party\FatFs\src\option\unicode.c

STM32Cube_FW_H7_V1.4.0\Middlewares\Third_Party\FatFs\src\option\ccsbcs.c

On the H7 one typically clocks the SDMMC unit at 200 MHz, code elsewhere makes assumptions. See SDMMC_INIT_CLK_DIV define

Initial card access is at 400 KHz, it only sets up higher if it can talk to the card. So wiring or power is bad.

Check if there are expectations for a Card Detect pin.

Make sure USE_SD_TRANSCEIVER is zero if you don't have this voltage translation chip.

STM32Cube_FW_H7_V1.4.0\Drivers\STM32H7xx_HAL_Driver\Inc\stm32h7xx_ll_sdmmc.h

/* SDMMC Initialization Frequency (400KHz max) for Peripheral CLK 200MHz*/

#define SDMMC_INIT_CLK_DIV ((uint8_t)0xFA)

You might want a better adapter, that doesn't have logic on it.

0690X00000AqZ8iQAF.jpg

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

thanks for your answer =)

I added the missing files, the error was still present.

I checked with debugger, the SD card is detected, so the error doesn't comes from here.

I found precisely where it fails.

it's during SD_SendSDStatus, it returns HAL_SD_ERROR_DATA_CRC_FAIL

else if(__HAL_SD_GET_FLAG(hsd, SDMMC_FLAG_DCRCFAIL))
 {
   return HAL_SD_ERROR_DATA_CRC_FAIL;
 }

I am now on a 4bit mode SD reader, I changed to 4Bits in cubeMX.

my reader has nothing but the sd slot, no resistors, no voltage translator on the board. I added 10k pull-up resistors on dat0,1,2,3 and cmd, everything connected on a breadboard

 edit:

in fact I realized it failed even before f_mount;

it fails in HAL_SD_Init(&hsd1) during MX_SDMMC1_SD_Init();

the fact is, HAL_SD_Init is also called during f_mount, but it fails even before calling f_mount