Altamash Abdul Rahim

STM32CubeMX SD CARD Code Bug

Discussion created by Altamash Abdul Rahim on Jan 31, 2018
Latest reply on Jan 31, 2018 by Clive One

Hello,

A while I used stm32cubemx for generating a code for SD card connection to my stm32f4 with SDIO and FATFS middleware and it worked fine but after the recent cube update the similar code does not works for sd card. Luckily i found out the problem. It seems they have not initialized the card in SD_DISKIO.c in SD_initialize()  function change the function to
DSTATUS SD_initialize(BYTE lun)
{
  Stat = STA_NOINIT;

 

  if(BSP_SD_Init() == MSD_OK)
  {
    Stat &= ~STA_NOINIT;
  }

 

  return Stat;
}

and it works fine also pull up the SDIO PINS.@@@

 

NOTE: DISABLE DMA IN FATFS IF NOT USING DMA IN SDIO. IT IS ENABLED BY DEFAULT IN FATFS contrary to previous versions.#

Outcomes