Question
STM32F446VET6 SD card problem. Using CubeMX and CubeIDE with latest updates (7/3/22)
Hi, I have an issue with the SD card on a STM32 F446VET.
if(f_mount(&SDFatFS, (TCHAR const*)SDPath, 0) != FR_OK)
{
Error_Handler();
}
else
{
/*DWORD fre_clust,tot_sect,fre_sect;
FATFS *fs;
f_getfree("1:",&fre_clust,&fs );
//if (res) die(res);
/* Get total sectors and free sectors */
//tot_sect = (fs->n_fatent - 2) * fs->csize;
// fre_sect = fre_clust * fs->csize;
/* Print the free space (assuming 512 bytes/sector)
// printf("%10lu KiB total drive space.\n%10lu KiB available.\n", tot_sect / 2, fre_sect / 2);*/
res=f_mkfs((TCHAR const*)SDPath, FM_ANY, 0, rtext, sizeof(rtext));
if(res != FR_OK)
{
Error_Handler();
}
else
{
//Open file for writing (Create)
if(f_open(&SDFile, "STM32.TXT", FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)
{
Error_Handler();
}
else
{
//Write to the text file
res = f_write(&SDFile, wtext, strlen((char *)wtext), (void *)&byteswritten);
if((byteswritten == 0) || (res != FR_OK))
{
Error_Handler();
}
else
{
f_close(&SDFile);
}
}
}
}
f_mount(&SDFatFS, (TCHAR const*)NULL, 0);the error comes at the f_mkfs() that returns FR_NOT_READY Error. Tried the same code on an NUCLEO F446RE and on an STM32F746G-DICSO on both ones it works and it creates and writes the text file.
When connected the logic analyzer to the SD card the Clock is showing fine, the SDIO_CMD and SDIO_D0 no signal at all.
- What that error means.
- Could it be from the resistors ? The Discovery one has a 47K or 4.7k resistors at the SDIO lines