LPC845 : DMA : how to load next dma_descriptor_t before transfert completion?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC845 : DMA : how to load next dma_descriptor_t before transfert completion?

1,173 次查看
v_canoz
Contributor III

Hello,

I have configured the DMA to use a ping pong buffer. Using DMA_GetRemainingBytes() I am able to get the transfer count. I want to manually switch the DMA to the other buffer without waiting for the DMA transfer completion. How can I do this?

And regarding to the context of this project, I am modifying the USART DMA example from the SDK of the LPC845 in order to add a timeout. The buffers are 50 bytes long.

while (1)
{
for(volatile int i =0; i <1000000; i ++)
{
}

PRINTF("\nloop\n");

DMA_DisableChannelInterrupts(EXAMPLE_USART_DMA_BASEADDR, USART_RX_DMA_CHANNEL);
uint32_t bytes_transfered = DMA_GetRemainingBytes(EXAMPLE_USART_DMA_BASEADDR, USART_RX_DMA_CHANNEL);

uint32_t inta = (EXAMPLE_USART_DMA_BASEADDR->CHANNEL[USART_RX_DMA_CHANNEL].XFERCFG >> 4) & 1UL;
uint32_t intb = (EXAMPLE_USART_DMA_BASEADDR->CHANNEL[USART_RX_DMA_CHANNEL].XFERCFG >> 5) & 1UL;

//CODE HERE TO SWITCH TO THE OTHER BUFFER

DMA_EnableChannelInterrupts(EXAMPLE_USART_DMA_BASEADDR, USART_RX_DMA_CHANNEL);

bytes_transfered = BUF_LEN - bytes_transfered;
PRINTF("bytes_transfered = %d, inta = %d, intb = %d",bytes_transfered,inta,intb);
}

pastedImage_2.png

Thanks in advance,

Victor

标记 (2)
0 项奖励
回复
1 回复

1,130 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Victor Canoz,

"I want to manually switch the DMA to the other buffer without waiting for the DMA transfer completion. How can I do this?"

-> How about stop DMA and re-config it ?

0 项奖励
回复