STM32CubeMX v4.26 SD Card Problem Continues [STM32F4 Discovery]
Hi,
I've been dealing with the SD card problem since the CubeMX version 4.
Here are the corresponding parts of my code:
...
...
...
/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/ FATFS myFATFS = {0}; FIL myFILE; UINT testByte;/* USER CODE END PV */
...
...
...
/* USER CODE BEGIN 2 */
if(f_mount(&myFATFS, SDPath, 1) == FR_OK){ char myPath[] = 'WRITE1.TXT\0'; f_open(&myFILE, myPath, FA_WRITE | FA_OPEN_ALWAYS); char myData[] = 'Hello World\0'; f_write(&myFILE, myData, sizeof(myData), &testByte); f_close(&myFILE); HAL_Delay(1000); } /* USER CODE END 2 */...
...
...
Here, the problem is in f_mount, it doesn't go forward. Debugging further, the code stucks in 'ff.c' file at the following bold line (line 3050):
/* Find an FAT partition on the drive. Supports only generic partitioning rules, FDISK and SFD. */
bsect = 0;
fmt = check_fs(fs, bsect); /* Load sector 0 and check if it is an FAT-VBR as SFD */
if (fmt == 2 || (fmt < 2 && LD2PT(vol) != 0)) { /* Not an FAT-VBR or forced partition number */
for (i = 0; i < 4; i++) { /* Get partition offset */
pt = fs->win + (MBR_Table + i * SZ_PTE);
br[i] = pt[PTE_System] ? ld_dword(pt + PTE_StLba) : 0;
}
This problem continues in the last 4 version, and still not fixed. Can someone try to create a project from scratch with STM32CubeMX version 4.26 and FW F4 v1.21 which are both the lastest versions by the moment?
Here are few extra notes:
- I set minimum heap and stack size as 0x2000 and 0x4000.
- I'm using Keil uVision MDK v5.15 with compiler v5.05 update 2 (build 169).
- My operating system is Windows 7 Pro SP1 64 bits.
- I'm sure that there is no hardware issue as I was able to run the SD card with a example project.
Regards,
Ogulcan
#f_mount #stm32cube-fw_f4-v1.0 #cubemx-4.26 #fw_f4-v1.0 #sd-card #cubemx #stm32f4 #fatfs #sdcard-fatfs Note: this post was migrated and contained many threaded conversations, some content may be missing.