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

1,737 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
5 Replies

1,647 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

1,635 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@rvalente

         below is my code,you can refer to it.

step1.

Senlent_0-1626232580961.png

step2.

Senlent_1-1626232602559.png

step3.

Senlent_2-1626232661970.png

step4.

Senlent_3-1626232728554.png

Done! 

 

Best Regards!

Jim,

1,714 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.png

 

Senlent_1-1625805802625.png

 

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

BR,Jim

1,678 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

1,657 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_1-1626156948925.png

Hope this answer is useful to you!

best regards!

Jim

0 Kudos