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 件の賞賛
返信