牛卧堂MCU技术交流
标题:
NUC972 UART RX DMA 问题
[打印本页]
作者:
匿名
时间:
2021-5-27 23:09
标题:
NUC972 UART RX DMA 问题
目的: 用DMA 把串口9的接收数据放到一个数组
代码:
CHAR buf[]={0x03,0x03,0x9C,0x4B,0x00,0x01};
outpw(REG_GDMA_CTL0, 0x0);
outpw(REG_GDMA_SRCB0,REG_UART9_RBR);//source
outpw(REG_GDMA_DSTB0,(uint32_t)DMARecBuf);//destination
outpw(REG_GDMA_TCNT0,7);
outpw(REG_GDMA_CTL0,(1<<7) | (1<<16));
outpw(REG_GDMA_CTL0,inpw(REG_GDMA_CTL0)|1);
comSend(buf,6);
while(!(inpw(REG_GDMA_INTCS) & 0x100));
outpw(REG_GDMA_INTCS,0x100);
问题点
bug = DMARecBuf[0]; //如果增加这一句代码后,就没有接收数据到
DMARecBuf
作者:
arthur
时间:
2021-6-1 10:54
是楼主的 typo 吗?从上面看 GDMA使用的是 Channel 0, 最后却是 REG_GDMA_INTCS: 0x100 设置的是 Channel 1的中断?
作者:
匿名
时间:
2021-6-2 20:38
Publication Release Date: Dec. 15, 2015
- 321 - Revision V1.30
NUC970 TECHNICAL REFERENCE MANUAL
[8] TC0F
Channel 0 Terminal Count
0 = Channel does not expire.
1 = Channel expires; this bit is set only by GDMA hardware, and clear by software to
write logic 1.
TC0 is the GDMA interrupt flag. TC0 or GDMATERR0 will generate interrupt
作者:
arthur
时间:
2021-6-11 13:07
参考现有的BSP代码:
NUC980_NonOS_BSP\SampleCode\UART_PDMA
欢迎光临 牛卧堂MCU技术交流 (http://nuvoton-mcu.com/)
Powered by Discuz! X3.2