2018-07-12 11:44 PM
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.
2018-07-13 06:06 AM
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
2018-07-13 08:45 AM
Hello Imen,
Thank you very much for answered
2018-07-13 08:46 AM
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.
2018-07-13 08:48 AM
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
2018-07-13 09:36 AM
https://community.st.com/0D50X00009XkWXwSAN
prior thread on same topic2018-07-15 09:32 AM
Can you show us your code? What parts was modified?
2018-07-16 01:50 AM
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 */}2018-07-16 05:06 AM
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 */}