Michael Stumbra

DMA GetRemainingBytes bug report

Discussion created by Michael Stumbra on Oct 11, 2017
Latest reply on Oct 19, 2017 by Carlos_Mendoza

Hello

Bug in fsl_dma.c of LPC546xx SDK v2.2.0;

function uint32_t DMA_GetRemainingBytes(DMA_Type *base, uint32_t channel)

 

return statement doesn't perform masking and bit shifting as in other functions of same source file. Also "+1" performed for register value, instead of actual XFERCOUNT value.

 

fix:

return base->CHANNEL[channel].XFERCFG + 1;

change to

return ((base->CHANNEL[channel].XFERCFG & DMA_CHANNEL_XFERCFG_XFERCOUNT_MASK) >> DMA_CHANNEL_XFERCFG_XFERCOUNT_SHIFT) + 1;

Outcomes