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.
return base->CHANNEL[channel].XFERCFG + 1;
return ((base->CHANNEL[channel].XFERCFG & DMA_CHANNEL_XFERCFG_XFERCOUNT_MASK) >> DMA_CHANNEL_XFERCFG_XFERCOUNT_SHIFT) + 1;
Thank you for reporting this, I have sent this report to the SDK development team.
Technical Support Engineer