kiwih / cubeide-sd-card

CubeIDE/CubeMX compatible MMC/SD memory card FatFs driver
Other
103 stars 59 forks source link

F411 SPI5 Tx/Rx Not Triggered #17

Open djsg opened 1 year ago

djsg commented 1 year ago

Hi,

Following your blog, I have created a project for my F411 PCB board, where SPI5 is used for MCU to talk to SD card module. I run my code and even cannot do the mounting, always getting error code 3. So I did something like this: continuously trying f_mount `

while(1) {

fres = f_mount(&FatFs, "", 1); //1=mount now

if (fres == FR_OK) {

  break;

}
sprintf(log_str, "f_mount error (%i)\r\n", fres);

HAL_UART_Transmit(&huart2, (uint8_t *)log_str, strlen(log_str), 0xFFFF);

} `

After first error code 3, subsequently I got error code 1. I used scope to monitor SPI5 SCK signal when running that infinite loop, it was flat. However, if I just continuously call HAL_SPI_Transmit(&hspi5, tx_data, 4, 200);, I can see SCK signal.

In my main.h, I do have #define SD_SPI_HANDLE hspi5 Can anyone shed some light on what I have missed?