AnsweredAssumed Answered

SD can't read write

Question asked by salian.punit.001 on Oct 28, 2016
Latest reply on Nov 2, 2016 by salian.punit.001
Hey guys I am trying to interface sd card with stm32F4 but things are not working,code was developed using cubemx
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();
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_SDIO_SD_Init();
  MX_FATFS_Init();
 
  HAL_Delay(1000);
 
  /* USER CODE BEGIN 2 */
  if(f_mount(&mynewdiskFatFs,(const TCHAR*)SD_Path, 0) == FR_OK)
       {
        if(f_open(&MyFile, "abc.txt",  FA_READ ) == FR_OK)
        {
            // GPIO_SetBits(GPIOD, GPIO_Pin_15);
         if(f_read(&MyFile, wtext, sizeof(wtext), (void *)&wbytes) ==FR_OK);
         {
             f_close(&MyFile);
         }
       }
       }
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
 
  }
  /* USER CODE END 3 */
 
}

1]Interface is sdio 1 bit mode(due to pin constraints)
2]Sd card 8Gb formated with default allocation size

Steps taken to debug:
I single step through the code fmount is successful but when i step through fopen there a error code at find_volume() returning FR_NOT_READY.

Hardware conections :I have arduino micro sd breakout board with SPI pins so connection are
DI---SDIO_CMD
DO---SDIO_D0
SCLK---SDIO_SCLK





Outcomes