AnsweredAssumed Answered

STM32F407VG + 4 bit SDIO + DMA does not work probably

Question asked by Julian Hindelang on Apr 27, 2018
Latest reply on May 18, 2018 by Julian Hindelang

Hi,

 

I am using the STM32F407VG and try to read an SD Card over SDIO in 4 bit mode.

I have downloaded the fatfs driver from this site: http://stm32f4-discovery.net/2015/08/hal-library-20-fatfs-for-stm32fxxx/


The initialization works absolutely fine until the second invocation of check_fs in line 3008 of ff.c
"fmt = bsect ? check_fs(fs, bsect) : 3; /* Check the partition */"

 

(Note: The first invocation of check_fs in line 2998 "fmt = check_fs(fs, bsect);" returns the correct value (2))

 

Where it sticks after the check_fs invocation is in the interrupt of the DMA RX interrupt callback:

static void SD_DMA_RxCplt(DMA_HandleTypeDef *hdma)
{
    SD_HandleTypeDef *hsd = (SD_HandleTypeDef*)((DMA_HandleTypeDef*)hdma)->Parent;

    /* DMA transfer is complete */
    hsd->DmaTransferCplt = 1U;

    /* Wait until SD transfer is complete */
    while(hsd->SdTransferCplt == 0U)
    {
    }

    /* Disable the DMA channel */
    HAL_DMA_Abort(hdma);

    /* Transfer complete user callback */
    HAL_SD_DMA_RxCpltCallback(hsd->hdmarx);
}

line 9 ("while(hsd->SdTransferCplt == 0U)).

 

Any ideas what is going wrong?

Outcomes