cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO USE SDIO WITH STM32F429ZI

kadir ustun1
Senior
Posted on July 13, 2018 at 08:44

Hello everyone, I want to use SD CARD with SDIO on stm32f429zı. But I don't work. Can you help me please ? I take FR_DISK_ERR.

8 REPLIES 8
Imen.D
ST Employee
Posted on July 13, 2018 at 15:06

Hello

_st_n.kadir

 ,

I would recommend you to look at the 

FatFs_uSD 

example under STM32CubeF4 package:

STM32Cube_FW_F4_V1.21.0\Projects\STM324x9I_EVAL\Applications\FatFs\FatFs_uSD

https://community.st.com/0D50X00009bMM7JSAW

 

Hope this helps you.

With Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on July 13, 2018 at 15:45

Hello Imen,

Thank you very much for answered

Matthew Shaw
Associate II
Posted on July 13, 2018 at 17:46

I think I am seeing the same issue. I am using an STM32F4, FATFS, DMA with 4bit SDIO with a BSP layer between FATFS and the HAL SD/MMC library.

In ff.c the call disk_initialize returns succesfully.

Then it performs the call check_fs. This is the function returning FR_NO_FILESYSTEM.

From here the callstack goes:b check_fs (ff.c)> move_window (ff.c) > disk_read (diskio.c)> SD_read (sd_diskio.c) > BSP_SD_GetCardState (bsp_driver_sd.c) > HAL_SD_GetCardState (stm32f4xx_hal_sd.c) > SD_SendStatus (stm32f4xx_hal_sd.c) > SDMMC_CmdSendStatus (stm32f4xx_ll_sdmmc.c) > SDMMC_GetCmdResp1 (

stm32f4xx_ll_sdmmc.c).

It is here that the failure occurs. When this issue first presented itself the SDMMC_GetCmdResp1 call was timing out.

After implementing the suggestions made by

Moshkin.Georgy

  check_fs now fails with a 3: &393:Not a BS&39.

https://community.st.com/0D50X00009XkeZ4SAJ

 

I also followed the advice of 

Alvarez.German at:

https://community.st.com/0D50X00009XkYHXSA3

 

Any suggestions or direction would be appreciated.

Posted on July 13, 2018 at 15:48

I tried this example :

STM32Cube_FW_F4_V1.21.0\Projects\STM324x9I_EVAL\Applications\FatFs\FatFs_uSD

but it is don't work. error : FA_DISK_ERR

Posted on July 13, 2018 at 16:36

https://community.st.com/0D50X00009XkWXwSAN

prior thread on same topic
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on July 15, 2018 at 16:32

Can you show us your code? What parts was modified?

Posted on July 16, 2018 at 08:50

Hello, Thank you for answered. I solved this problem. I fixed this code below:

in stm32f4xx_it.c : 

void DMA2_Stream3_IRQHandler(void)

{

/* USER CODE BEGIN DMA2_Stream3_IRQn 0 */

/* USER CODE END DMA2_Stream3_IRQn 0 */

HAL_DMA_IRQHandler(&hdma_sdio_rx);

/* USER CODE BEGIN DMA2_Stream3_IRQn 1 */

/* USER CODE END DMA2_Stream3_IRQn 1 */

}

/**

* @brief This function handles DMA2 stream6 global interrupt.

*/

void DMA2_Stream6_IRQHandler(void)

{

/* USER CODE BEGIN DMA2_Stream6_IRQn 0 */

/* USER CODE END DMA2_Stream6_IRQn 0 */

HAL_DMA_IRQHandler(&hdma_sdio_tx);

/* USER CODE BEGIN DMA2_Stream6_IRQn 1 */

/* USER CODE END DMA2_Stream6_IRQn 1 */

}

void SDIO_IRQHandler(void)

{

//BSP_SD_ReadCpltCallback();

HAL_SD_IRQHandler(&hsd);

//__HAL_SD_CLEAR_IT(&hsd,SDIO_IT_SDIOIT);

}

then, in HAL_SD_RxCpltCallback(hsd);  in  

HAL_SD_IRQHandler(&hsd) 

__weak void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)

{

/* Prevent unused argument(s) compilation warning */

BSP_SD_ReadCpltCallback();

//UNUSED(hsd);

/* NOTE : This function should not be modified, when the callback is needed,

the HAL_SD_RxCpltCallback can be implemented in the user file

*/

}

and same in 

HAL_SD_TxCpltCallback(hsd);  in  

HAL_SD_IRQHandler(&hsd) 

__weak void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)

{

/* Prevent unused argument(s) compilation warning */

BSP_SD_WriteCpltCallback();

// UNUSED(hsd);

/* NOTE : This function should not be modified, when the callback is needed,

the HAL_SD_TxCpltCallback can be implemented in the user file

*/

}
Posted on July 16, 2018 at 12:06

firstly I used Cubemx. I actived DMA_TX and DMA_RX and SDI Global interrupt. In stm32f4xx_it.c file

void SDIO_IRQHandler(void)

{

//BSP_SD_ReadCpltCallback();

HAL_SD_IRQHandler(&hsd);

//__HAL_SD_CLEAR_IT(&hsd,SDIO_IT_SDIOIT);

}

In stm32f4xx_hal_sd.c file AGO :

__weak void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)

{

/* Prevent unused argument(s) compilation warning */

UNUSED(hsd);

/* NOTE : This function should not be modified, when the callback is needed,

the HAL_SD_TxCpltCallback can be implemented in the user file

*/

}

/**

* @brief Rx Transfer completed callbacks

* @param hsd Pointer SD handle

* @retval None

*/

__weak void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)

{

/* Prevent unused argument(s) compilation warning */

UNUSED(hsd);

/* NOTE : This function should not be modified, when the callback is needed,

the HAL_SD_RxCpltCallback can be implemented in the user file

*/

}

I changed this functions :

__weak void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)

{

/* Prevent unused argument(s) compilation warning */

BSP_SD_WriteCpltCallback();

// UNUSED(hsd);

/* NOTE : This function should not be modified, when the callback is needed,

the HAL_SD_TxCpltCallback can be implemented in the user file

*/

}

/**

* @brief Rx Transfer completed callbacks

* @param hsd Pointer SD handle

* @retval None

*/

__weak void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)

{

/* Prevent unused argument(s) compilation warning */

BSP_SD_ReadCpltCallback();

//UNUSED(hsd);

/* NOTE : This function should not be modified, when the callback is needed,

the HAL_SD_RxCpltCallback can be implemented in the user file

*/

}