microSD on Nucleo-144 STM32H723ZG - Can't make SDIO work.
Hi All,
I am trying to use microSD on Nucleo-144 STM32H723ZG(T6U) by using an external microSD module called "Pmod MicroSD" by digilent Pmod microSD Card Slot. The SD card I am using is this one: Trancend 4GB MicroSD . I am able to use the SD card with SPI, but struggle with SDIO (which the slot and card is supposed to support, not SDMMC).
I have connected the slot as following:
D0(Pin 3) to PC8, D1(Pin 7) to PC9, D2(Pin 8) to PC10, D3(Pin 1) to PC11, SCK(Pin 4) to PC12, CMD(Pin 2) to PD2
+ GND - GND, and VCC - 3.3V
In STM32CubeIDE I set SDIO by choosing SDMMC1 in connectivity, then "SD 4 bits Wide bus". I make sure the pins correspond to how I have connected. Everything else is set default here.
Then I choose FATFS, SD Card. Here we have one thing called Detect_SDIO: I dont know what this is, and what I need to connect there from the Pmod, or if that is needed. I need at least to choose a GPIO input, and chose it as PA3.
Then I choose Automatic clock resolver. (SDMMC1 is set to 96MHz).
Then I added this code + the declaration.
/* USER CODE BEGIN 2 */
if(f_mount(&SDFatFS, (TCHAR const*)SDPath, 0) != FR_OK){
myPrint("Mount Failed\r\n");
}else{
myPrint("Mount Success\r\n");
}
if(f_mkfs((TCHAR const*)SDPath, FM_ANY, 0, rtext, sizeof(rtext)) != FR_OK){
myPrint("Make of filesystem Failed\r\n");
}else{
myPrint("Make of filesystem Success\r\n");
}
if(f_open(&SDFile, "test.txt", FA_CREATE_ALWAYS | FA_WRITE) != FR_OK){
myPrint("File open/make Failed\r\n");
}else{
myPrint("File open/make Success\r\n");
res = f_write(&SDFile, wtext, strlen((char *)wtext), (void *)&byteswritten);
if((byteswritten == 0) || (res != FR_OK))
{
myPrint("Write Failed\r\n");
}
else
{
myPrint("Write Success\r\n");
f_close(&SDFile);
}
}
/* USER CODE END 2 */
Still not working. Tried to change clock divider to 100, no change.
Mount Success
Make of filesystem Failed
File open/make Failed
Any inputs on what I am doing wrong?
Do I need to configure anything else?
Thanks for all future answers!
