Attempting to read/write to SD card via SDIO on STM32F
I'm trying to read and write to a microSD card using this reader from sparkfun https://www.sparkfun.com/products/12941 and a nucleo board with a STM32F429ZIT6U MCU via SDIO interface. I created the project through CubeMX V 4.21 (I used the most current version 5.2 at first and ran into issues then saw some forums that said 4.21 was more stable). SDIO and FatFs middle ware were enabled in CubeMx and well as LED1 and LED2 (PB0 and PB7). I got the program from and followed these series of videos for the main.c code https://www.youtube.com/watch?v=Y5UMTGQDmog and https://www.youtube.com/watch?v=0NbBem8U80Y&t=218s. Here's a snip of main.c
/* USER CODE BEGIN 0 */
//define global variables
FATFS myFATFAS;
FIL myFILE;
UINT testByte;
/* USER CODE END 0 */
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SDIO_SD_Init();
MX_FATFS_Init();
/* USER CODE BEGIN 2 */
if(f_mount(&myFATFAS, SD_Path, 1) == FR_OK){
HAL_GPIO_TogglePin (GPIOB, GPIO_PIN_0); //toggle green LED
char myPath[] = "WRITE2.txt\0"; //creates file
f_open(&myFILE , myPath, FA_WRITE | FA_CREATE_ALWAYS);
char myData[] = "HELLO WORLD\0"; //data that is writen to file
f_write(&myFILE, myData, sizeof(myData), &testByte);
f_close(&myFILE);
HAL_Delay(1000);
HAL_GPIO_TogglePin (GPIOB, GPIO_PIN_0); //toggle green LED
}
else{
HAL_GPIO_TogglePin (GPIOB, GPIO_PIN_7); //toggle blue LED if not mounting
HAL_Delay(1000);
}When I run my code in True studio f_mount doesn't work. More specifically res = find_volume(&fs, &path, 0) in ff.c line 2511 doesn't return FR_OK. I've attached the VCC and ground wires to 3.3V and ground on my board and DO, SCK,and DI to PC_8, PC_12, and PD_2 respectively.
The micro SD card is formatted to FAT32. No files are created on my MicroSD card and I've no idea what I'm doing wrong.