Skip to content

Commit

Permalink
fix: SD_RX_OVERRUN error when used in multithread RTOS, change to use…
Browse files Browse the repository at this point in the history
… DMA

fix: SD_DMA_RxCplt() dead locked cause by while(hsd->SdTransferCplt == 0)
fix: SD_DMA_TxCplt()dead locked cause by while(hsd->SdTransferCplt == 0)
  • Loading branch information
skywolf committed Apr 23, 2015
1 parent 656de1b commit f4d5409
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c
Expand Up @@ -2272,9 +2272,9 @@ static void SD_DMA_RxCplt(DMA_HandleTypeDef *hdma)
hsd->DmaTransferCplt = 1;

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

/* Disable the DMA channel */
HAL_DMA_Abort(hdma);
Expand Down Expand Up @@ -2311,9 +2311,9 @@ static void SD_DMA_TxCplt(DMA_HandleTypeDef *hdma)
hsd->DmaTransferCplt = 1;

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

/* Disable the DMA channel */
HAL_DMA_Abort(hdma);
Expand Down
4 changes: 2 additions & 2 deletions Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c
Expand Up @@ -111,7 +111,7 @@ DRESULT SD_read(BYTE *buff, DWORD sector, UINT count)
{
DRESULT res = RES_OK;

if(BSP_SD_ReadBlocks((uint32_t*)buff,
if(BSP_SD_ReadBlocks_DMA((uint32_t*)buff,
(uint64_t) (sector * BLOCK_SIZE),
BLOCK_SIZE,
count) != MSD_OK)
Expand All @@ -134,7 +134,7 @@ DRESULT SD_write(const BYTE *buff, DWORD sector, UINT count)
{
DRESULT res = RES_OK;

if(BSP_SD_WriteBlocks((uint32_t*)buff,
if(BSP_SD_WriteBlocks_DMA((uint32_t*)buff,
(uint64_t)(sector * BLOCK_SIZE),
BLOCK_SIZE, count) != MSD_OK)
{
Expand Down

0 comments on commit f4d5409

Please sign in to comment.