使用DMA将ADC12的数据搬移到RAM中,由于RAM空间较小,而FRAM较大,所以想把目标地址指定到FRAM
指定到RAM中的相关代码如下,经过测试没问题
uint16_t dataRecorded1[DataSize] = {0};
DMA_setDstAddress(DMA_CHANNEL_0, (uint32_t) (&dataRecorded1),DMA_DIRECTION_INCREMENT);
指定到FRAM中的相关代码如下,经过测试数据全是0,程序其它地方没有任何改动,这是为什么?
#pragma LOCATION(dataRecorded1, 0x10000);
#pragma PERSISTENT(dataRecorded1);
uint16_t dataRecorded1[DataSize] = {0};
DMA_setDstAddress(DMA_CHANNEL_0, (uint32_t) (&dataRecorded1),DMA_DIRECTION_INCREMENT);
m:
?
Loops:
回复 m:
你可以参考下面代码更改测试下.
__data16_write_addr((unsigned short) &DMA0SA,(unsigned long) &ADC12MEM0); // Source block address __data16_write_addr((unsigned short) &DMA0DA,(unsigned long) &input); // Destination single address DMA0SZ = 1024; // Block size DMA0CTL = DMADT_4 | DMASRCINCR_0 | DMADSTINCR_3; // Rpt, inc DMA0CTL |= DMAEN|DMAIE; // Enable DMA0 DMACTL0 |= DMA0TSEL_26;
m:
回复 Loops:
&input 是什么? DMA0SZ = 1024这太小了,DMA0SZ 过小的话我的代码没问题,但是太大就不行了,我希望DMA0SZ 大于64KB
m:
求回答啊