Question
sdcard: f_mount returns FR_NOT_READY in CubeMX-generated project
Posted on June 17, 2018 at 08:44
Environment:
STM32469I-EVAL Windows 10 x64 STM32CubeMX v. 4.25.0 STM32Cube FW_F4 V1.21.0 System Workbench for STM32 Version: 1.15.0.201708311556 SD card inserted, code sample Projects\STM32469I_EVAL\Applications\FatFs\FatFs_uSD_RTOS is working. Steps to reproduce the problem: CubeMX, create new STM32469I-EVAL project. Pinout. SDIO: SD 1 bit SYS, Timebase Source: TIM1 FATFS: SD card FreeRTOS: enabled Configuration. FREERTOS, default task stack size 1024 Generate SW4STM32 source code in CubeMX. Open generated project in STM32 Workbench and make the following changes in the code: void _Error_Handler(char *file, int line) { /* USER CODE BEGIN Error_Handler_Debug */ HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET); while(1) { } /* USER CODE END Error_Handler_Debug */ } void StartDefaultTask(void const * argument) { /* init code for FATFS */ MX_FATFS_Init(); /* USER CODE BEGIN 5 */ // Turn off all LEDs HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(LED4_GPIO_Port, LED4_Pin, GPIO_PIN_SET); // Check result of MX_FATFS_Init if (retSD != 0) { _Error_Handler(__FILE__, __LINE__); } FRESULT fresult; FATFS SDFatFs; fresult = f_mount(&SDFatFs, (TCHAR const*)SDPath, 1); // runs several seconds, returns 3 // Checked in the debugger: // resSD = 0, SDPATH = '0:/', fresut = 3 (FR_NOT_READY) if( fresult != FR_OK ) { _Error_Handler(__FILE__, __LINE__); } HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET); for(;;) { osDelay(1); } /* USER CODE END 5 */ }f_mount returns FR_NOT_READY. The same code was working in one of previous STM32CubeMX and firmware package versions. ioc project and main.c files are attached.#fatfs #sdcard #sdio #stm32469i-eval