S32K144 ADC to DMA with circular buffer - looking for example

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

S32K144 ADC to DMA with circular buffer - looking for example

5,406 Views
rvalente
Contributor III

Hello, thats my first project with S32K.

I'm looking to find a example of how to implement a circular buffer (ADC to RAM using the DMA) in circular mode buffer. I need to sample 3s of data at 5KSa/s and keep these values in ram.

Attached is my project, the DMA is working fine but only one sample is being stored in buffer 

Greetings

Tags (3)
0 Kudos
Reply
6 Replies

5,316 Views
rvalente
Contributor III

Excellent! Worked exactly as I expected but, after the amount of data has been captured (buffer full), how should I restart the DMA buffer transfer?

0 Kudos
Reply

5,304 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@rvalente

         below is my code,you can refer to it.

step1.

Senlent_0-1626232580961.pngSenlent_0-1626232580961.png

step2.

Senlent_1-1626232602559.pngSenlent_1-1626232602559.png

step3.

Senlent_2-1626232661970.pngSenlent_2-1626232661970.png

step4.

Senlent_3-1626232728554.pngSenlent_3-1626232728554.png

Done! 

 

Best Regards!

Jim,

5,383 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@rvalente,

I use S32K142 EVB and modified some codes in your project to sample ADC0-SE8, ADC0-SE9, ADC0-SE12 through DMA, and then print the sampling results through the serial port.

Senlent_0-1625805802617.pngSenlent_0-1625805802617.png

 

Senlent_1-1625805802625.pngSenlent_1-1625805802625.png

 

You can try to optimize it,hope this will solve your problem.

BR,Jim

5,347 Views
rvalente
Contributor III

Hello,

tks by the reply but, I do not want to sample 3 channels sequentially, but to sample one channel at a given sample rate (then the use of lptmr) and have this sample fill the DMA buffer. So 3 seconds of sample @ 5KSa/s and 12 bits, Ill use 30720Bytes of ram.

So, how to set the DMA MODULO to sample and increment the buffer address?

0 Kudos
Reply

5,326 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@rvalente

    Sorry for the misunderstanding,I test this code and it should be what you want.

    You still need to modify some configurations to meet your needs(such as sample rates,buff size)

Senlent_0-1626156102676.pngSenlent_0-1626156102676.pngSenlent_1-1626156948925.pngSenlent_1-1626156948925.png

Hope this answer is useful to you!

best regards!

Jim

0 Kudos
Reply

2,065 Views
rohit1749
Contributor III

I'm trying to read analog pins PTD2(ADC1 channel2) and PTE6(ADC1 channel 11) using LPTMR, PDB1 and  DMA . I'm using DMA loop transfer to move contents of ADC1->R[0] to an user created buffer. But I'm not getting DMA callback, which is supposed to be received after successful DMA transfer.

Can someone tell me, where I'm going wrong. I have attached the project code zip file below.

 

Tags (1)
0 Kudos
Reply