Hi I am working on STM32F103c8t6 MCU.I am trying to run sd card with spi wiht this library https://github.com/eziya/STM32_SPI_SDCARD do every thing like youtube video and my connection is like video https://www.youtube.com/watch?v=spVIZO-jbxE&t=321s. This is a part of my cod:
send_uart("SD program ready....\r\n");
DSTATUS my_status = SD_disk_initialize(0);
if(my_status == STA_NOINIT ){
send_uart ("error in initializing SD CARD...\n");
}else send_uart ("SD initializing OK...\n");
if (my_status == STA_NODISK){
send_uart ("No medium in the drive...\n");
}
if (my_status == STA_PROTECT){
send_uart (" Write protected...\n");
}
fresult = f_mount(&fs, "0:", 1);
sprintf(buffer,"mounting SD CARD result:%d\n",fresult);
send_uart(buffer);
/* Create second file with read write access and open it */
fresult = f_open(&fil, "file2.txt", FA_CREATE_ALWAYS | FA_WRITE);
sprintf(buffer,"open SD CARD result:%d\n",fresult);
send_uart(buffer);
strcpy (buffer, "This is File2.txt, written using ...f_write... and it says Hello from
Controllerstech\n");
fresult = f_write(&fil, buffer, bufsize(buffer), &bw);
sprintf(buffer,"write SD CARD result:%d\n",fresult);
send_uart(buffer);
This is my response from uart:
SD program ready....
SD initializing OK...
mounting SD CARD result:1
open SD CARD result:1
write SD CARD result:9
return SD initializing OK.. but mounting SD CARD result:1 that means FR_DISK_ERR. What is the problem ? Iam using a SD module that has a 5v to 3v level shifter ic it can cuse problem?