Solved
NUCLEO-F429ZI - SDIO - FatFs Problem
Posted on June 11, 2018 at 09:56
Dear All,
I’m new to this forum and to stm32 board. I’m trying to connect an SD Card to my board NUCLEO-F429ZI but I’m having some problems with it. I use STM32CUBEMX to create the project using the standard peripherals settings. I put SDIO in SD 4 bit interfacing mode. I do not change anything in clock configuration. I connect the SD Card directly to SDIO PIN without any resistors as in picturehttp://www.openstm32.org/dl422?display
Board PIN SD Pin PD2 2 (CMD) PC8 7 (Dat0) PC9 8 (Dat1) PC10 9 (Dat2) PC11 1 (Dat3) PC12 5 (CLK)3.3V VCC
GND GND
this is the piece of code:
HAL_UART_Transmit(&huart3, “Start\r\n�, strlen(“Start\r\n�), 0xFFFF);
FRESULT res; uint32_t wbytes; uint8_t wtext[] = “text to write logical disk�; FATFS_LinkDriver(&SD_Driver, SDPath); if(f_mount(&SDFatFS, (TCHAR const*)SDPath, 0) == FR_OK) { HAL_UART_Transmit(&huart3, “Mounted\r\n�, strlen(“Mounted\r\n�), 0xFFFF); res = f_open(&SDFile, “STM32.TXT�, FA_CREATE_ALWAYS | FA_WRITE); if (res == FR_OK) { HAL_UART_Transmit(&huart3, “Opened\r\n�, strlen(“Opened\r\n�), 0xFFFF); if(f_write(&SDFile, wtext, sizeof(wtext), (void *)&wbytes) == FR_OK) { HAL_UART_Transmit(&huart3, “Written\r\n�, strlen(“Written\r\n�), 0xFFFF); f_close(&SDFile); HAL_UART_Transmit(&huart3, “Closed\r\n�, strlen(“Closed\r\n�), 0xFFFF); } } else { char msg; sprintf(msg, “Error open: %d\r\n�, res); HAL_UART_Transmit(&huart3, (uint8_t *)msg, strlen(msg), 0xFFFF); } } FATFS_UnLinkDriver(SDPath);The function F_MOUNT return FR_OK but the program stops there. Sometimes the f_open function return Error 3: Device not ready. Any suggestion?
Thank you for your time.M
