[MPC5777c] SDADC with using DMA

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

[MPC5777c] SDADC with using DMA

Jump to solution
529 Views
hanryang
Contributor II

Hello.

I'm trying to SDADC with using DMA for resolver Sin & Cos Signals.

So now I'm reffering to eTPURDCCUG.pdf with example codes (Example_MPC5777C-SDADC_eTPU_triggered_v0_0-GHS714 Example_MPC5777C_DSPI_Master_TXRX_DMA_S32DSPower21)

 

eTPURDCCUG.pdf suggets three DMA channels are used – two channels to transfer the ADC data of Sine and Cosine signals, and one channel to transfer the HSRs.

 

I wanna use SDA[0], SDA[1] for Sin signal and Cos signal.

Sin signal - SDA0

Cos signal - SDA1

 

Now I'm using eQADC with DMA, below the source code is summary of DMA init for eQADC. 

---- No 1. summary of DMA init for eQADC ---

DMA_A.TCD[0].SADDR.R = (vuint32_t) &A_CQUEUEX0; //  Start Address
DMA_A.TCD[0].DADDR.R =  CFIFO_A0_PUSH;    //  Destination address
 
DMA_A.TCD[1].SADDR.R = RFIFO_A0_POP;      //  Start Address //
DMA_A.TCD[1].DADDR.R = (vuint32_t) &A_RQUEUEX0;//  Destination address
 
DMA_A.TCD[2].SADDR.R = (vuint32_t) &A_CQUEUEX1; //  Start Address
DMA_A.TCD[2].DADDR.R =  CFIFO_A1_PUSH;    //  Destination address
 
DMA_A.TCD[3].SADDR.R = RFIFO_A1_POP;      //  Start Address //
DMA_A.TCD[3].DADDR.R = (vuint32_t) &A_RQUEUEX1;//  Destination address
 
DMA_B.TCD[0].SADDR.R = (vuint32_t) &B_CQUEUEX0; //  Start Address
DMA_B.TCD[0].DADDR.R =  CFIFO_B0_PUSH;    //  Destination address
 
DMA_B.TCD[1].SADDR.R = RFIFO_B0_POP;      //  Start Address //
DMA_B.TCD[1].DADDR.R = (vuint32_t) &B_RQUEUEX0;//  Destination address
 
DMA_B.TCD[2].SADDR.R = (U32)&B_CQUEUEX1; //  Start Address
DMA_B.TCD[2].DADDR.R = CFIFO_B1_PUSH;    //  Destination address
 
DMA_B.TCD[3].SADDR.R = RFIFO_B1_POP;      //  Start Address //eQADC
DMA_B.TCD[3].DADDR.R = (U32)&B_RQUEUEX1;//  Destination address
---- End of summary ----
 
----- No 2. Construction of DMA init for eQADC -----
DMA_A.TCD[0].SADDR.R = (vuint32_t) &A_CQUEUEX0; //  Start Address
DMA_A.TCD[0].DADDR.R =  CFIFO_A0_PUSH;    //  Destination address
DMA_A.TCD[0].ATTR.B.SMOD = 0x00; //  Source address modulo
DMA_A.TCD[0].ATTR.B.DMOD = 0x00; //  Destination address modulo
DMA_A.TCD[0].ATTR.B.DSIZE = 0x02; //  Destination transfer size : 32 Bits
DMA_A.TCD[0].ATTR.B.SSIZE = 0x02; //  Source transfer size : 32 Bits
DMA_A.TCD[0].SOFF.R = 0x04; //  Signed source address offset
DMA_A.TCD[0].NBYTES.MLNO.R = 0x00000004; //  Inner "minor" byte count
DMA_A.TCD[0].SLAST.R = -16; //  last Signed source address adjust
DMA_A.TCD[0].DOFF.R = (vint16_t)0x0;    //  Signed destination address offset
DMA_A.TCD[0].DLASTSGA.R = (vint32_t)0x0; //  Signed destination address adjust
DMA_A.TCD[0].BITER.ELINKYES.B.ELINK = 0x00; //  Disable Channel Linking  Minor Loop Channel Linking Disabled
DMA_A.TCD[0].BITER.ELINKYES.B.BITER = 0x0004; //  Beginning "major" iteration count - Minor Loop Channel Linking Disabled
DMA_A.TCD[0].CITER.ELINKYES.B.ELINK = 0x00;    //  Disable Channel Linking  Minor Loop Channel Linking Disabled
DMA_A.TCD[0].CITER.ELINKYES.B.CITER = 0x0004; //  Current "major" iteration count - Minor Loop Channel Linking Disabled
DMA_A.TCD[0].CSR.B.BWC = 0x00; //  Bandwidth control :  No DMA Stalls
DMA_A.TCD[0].CSR.B.MAJORLINKCH = 0x00; //  Major Channel number
DMA_A.TCD[0].CSR.B.MAJORELINK = 0x0; //  Major Channel Link : Disabled
DMA_A.TCD[0].CSR.B.DONE = 0x00; //  Channel Done
DMA_A.TCD[0].CSR.B.ACTIVE = 0x00; //  Channel ACtive
DMA_A.TCD[0].CSR.B.ESG = 0x0;
DMA_A.TCD[0].CSR.B.DREQ = 0x0;
DMA_A.TCD[0].CSR.B.INTHALF = 0x0;
DMA_A.TCD[0].CSR.B.INTMAJOR = 0x0;
DMA_A.TCD[0].CSR.B.START = 0;
----- End of construction of DMA init for eQADC-----
 
------ No.3 Construction  of SDADC_init from Example code -----

void SDADC2_Init(void)
{
/* for comments see SDADC1_Init */

SIU.SDCLKCFG.R = 0x0000003F;
SDADC_2.MCR.B.EN = 1;

/* TRIGSEL = 0101b = 5 = eTPU_A23 */
SDADC_2.MCR.R = 0x00001593;

SDADC_2.CSR.R = 0x0;
SDADC_2.OSDR.R = 0xFF;
SDADC_2.FCR.R = 0x107;
SDADC_2.RSER.R = 0x00000001;
}

------ End of construction SDADC_init  from Example code ------
 
 
*Question
1. how do I apply SDADC with using DMA for Sin - SDA[0], Cos - SDA[1], HSR ?
(Based on above eQADC code)
 
2. Can I perform DMA initialization for SDADC using the same structure as the DMA source code configuration for eQADC as in No.2 above?
(If not, Please let me know how to configurate)
 
3.To initialize SDADC using DMA, Is it correct to configure SDADC initialization in the same way as example code 3 above?
(If not, Please let me know how to configurate)
 
Thank you for always helping me.
 
Tags (1)
0 Kudos
Reply
1 Solution
483 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

I see. This table is described quite straightforward. Use recommended values.

For SDADC following channels is supposed to be used (eDMA_B):

davidtosenovjan_0-1729167576939.png

For HSR, you may use any channel.

 

View solution in original post

0 Kudos
Reply
3 Replies
511 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

According sketch in shows using differential inputs i.e. SIN by one pair of inputs, COS by another pair.

In comparison to eQADC - SDADC does not use any commands as you have in the TCD above. You will only need DMA transfers for results' draining.

Some general words to SDADC:
SDADC is targeted to high-precision, moderate input bandwidth AC signal processing (knock detection/in pressure cylinder control).
Once enabled the SDADC keeps running. There is no “Single conversion mode”. This requires converted data to be continually drained by DMA or ISR. The digital nature of the SDADC means that there is a propagation delay as the data is clocked through the internal digital filters. This has to be taken into account at startup or at any channel mux change. This latency means that the SDADC is not well suited to some applications including motor control. When used in an AC sampling application it is likely that each SDADC will have to be dedicated to a particular input rather than switching the input channel.
SDADC offers higher conversion accuracy (16-bit result).

SDADC is always combined with other type of ADC, on this device it is eQADC offering advanced triggering and channel multiplexing capability (on other MPC57xx device SDADC is supplemented by SAR ADC).

500 Views
hanryang
Contributor II

Thank you for your answer.

 

I'm a beginner level so I couldn't understand much of your explained without exmaples...

Can you show me how should I configure SDADC with using DMA?

I want to configure DMA configuration as shown in the table below.

hanryang_0-1729120503136.png

hanryang_2-1729120722324.png

 

I want to use SDA0 and SDA1 channel for Sine ADC FIFO DMA channel and Cosine ADC FIFO DMA channel, but I'm already using TCD[0] and TCD[1] for eQADC.

 

If I want to use SDA0 and SDA1 channel for DMA Channel, How should I do?

 

 

 

 

0 Kudos
Reply
484 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

I see. This table is described quite straightforward. Use recommended values.

For SDADC following channels is supposed to be used (eDMA_B):

davidtosenovjan_0-1729167576939.png

For HSR, you may use any channel.

 

0 Kudos
Reply