DMA setup with ADC16_RA as source

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DMA setup with ADC16_RA as source

Jump to solution
1,686 Views
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...

Labels (1)
Tags (3)
0 Kudos
1 Solution
1,411 Views
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;

}

View solution in original post

0 Kudos
2 Replies
1,411 Views
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 Kudos
1,412 Views
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 Kudos