S32K144 ADC to DMA with circular buffer - looking for example

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

S32K144 ADC to DMA with circular buffer - looking for example

2,457 次查看
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

标记 (3)
0 项奖励
回复
5 回复数

2,367 次查看
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 项奖励
回复

2,355 次查看
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,

2,434 次查看
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

2,398 次查看
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 项奖励
回复

2,377 次查看
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 项奖励
回复