DMA setup with ADC16_RA as source

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

DMA setup with ADC16_RA as source

跳至解决方案
1,732 次查看
TurboMan
Contributor IV

Hi,

   just asking this here as I can't get this to work. I can set up a RAM to RAM DMA transfer which works ok, I can trigger this with a timer, and that works. But I want to configure a timer or trigger to set the 16bit ADC converting, then transfer the data to a buffer.

   However, when I select ADC16_RA as a source, it doesn't work. It says "bus transfer terminated with an error on the read portion of the transfer". This indicates the address for ADC16_RA is wrong, but I've double checked and even put the address in had coded. The ADC result register should stay the same, the buffer address should increment, the data width is 16bits wide; All these things work ok when a RAM to RAM tansfer is set up.

   Any help / information would be great, thanks.

Regards...

标签 (1)
标记 (3)
0 项奖励
1 解答
1,457 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

I do not know whether you have solved your issue or not. I suspect you use MC56F84xxx or MC56F82xxx, which have DMA module. Regarding your problem, pls refer to section 13.3.3 Destination Address Register (DMA_DARn) in MC56F847xxRM.pdf, the DMA_DAR and DMA_SAR must have byte address rather than word address.

Pls use the following code:

#define   FQSPI0_SPDTR 0xE0B3

unsigned int array[SIZE]={

        0x3355,0x00FF,0x3355,0x00FF,0x3355,0x00FF,0x3355,0x00FF,0x3355,0x00FF,\

        0x3355,0x00FF,0x3355,0x00FF,0x3355,0x00FF

};

/DMA do the transfer function from memory buffer to SPI transmitter reg

void DMA_init()

{

    //initialize the DMA0

    //DMA0, 2, SPI0_RF Reciever Full, triggering source

    //DMA1, 2, SPI0_TE Transmit Empty,triggering source

    DMA_REQC=0x20000;  //set SPI0_TE trigger DMA

    DMA_SAR1=(long)&array[0]<<1;

    DMA_DAR1=(long)FQSPI0_SPDTR<<1;

    DMA_DSR_BCR1=0x04;

    DMA_DCR1=0x70642000;

}

在原帖中查看解决方案

0 项奖励
2 回复数
1,457 次查看
arpitaagarwal-b
NXP Employee
NXP Employee

Hello,

Is your source register is getting incremented after every transfer?

if so, check DMA_DCR_SINC bit. It should be 0 to keep the source address constant after every DMA transfer.

Can you share the complete DMA initialization code.

-Arpita

0 项奖励
1,458 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

I do not know whether you have solved your issue or not. I suspect you use MC56F84xxx or MC56F82xxx, which have DMA module. Regarding your problem, pls refer to section 13.3.3 Destination Address Register (DMA_DARn) in MC56F847xxRM.pdf, the DMA_DAR and DMA_SAR must have byte address rather than word address.

Pls use the following code:

#define   FQSPI0_SPDTR 0xE0B3

unsigned int array[SIZE]={

        0x3355,0x00FF,0x3355,0x00FF,0x3355,0x00FF,0x3355,0x00FF,0x3355,0x00FF,\

        0x3355,0x00FF,0x3355,0x00FF,0x3355,0x00FF

};

/DMA do the transfer function from memory buffer to SPI transmitter reg

void DMA_init()

{

    //initialize the DMA0

    //DMA0, 2, SPI0_RF Reciever Full, triggering source

    //DMA1, 2, SPI0_TE Transmit Empty,triggering source

    DMA_REQC=0x20000;  //set SPI0_TE trigger DMA

    DMA_SAR1=(long)&array[0]<<1;

    DMA_DAR1=(long)FQSPI0_SPDTR<<1;

    DMA_DSR_BCR1=0x04;

    DMA_DCR1=0x70642000;

}

0 项奖励