S32K312 Multi ADC channel with DMA

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

S32K312 Multi ADC channel with DMA

Jump to solution
4,268 Views
BrK_
Contributor III

Hi, 

I want to read 5 ADC channels. Two of them are ADC-0 and the other three are ADC-1 channels. And I want to save the conversions to the buffer I provided with dma. However, BCTU cannot run dma.

Let me briefly explain what I did.

I configured ADC-0 and ADC-1:

BrK__0-1695725408640.png

 

And also i configured related channels

ADC-0:

BrK__1-1695725408660.png

 

ADC-1:

BrK__2-1695725408471.png

 

BCTU configurations:

BrK__3-1695725408781.png

 

BrK__4-1695725408891.png

 

TRGMUX and PIT configurations:

BrK__5-1695725408609.png

 

BrK__6-1695725408630.png

 

DMA configurations:

BrK__7-1695725409121.png

 

Even though I made all these configurations, no data is written to the buffer I gave to DMA.

When I check FIFODR1 with debug, I see the data, but FIFO does not run DMA for some reason.

When I reviewed the driver functions, I saw that bctu turns off the DMA hardware request every time the transfer ends in DMA configurations.

To prevent this, the function named Bctu_Ip_FifoDmaHandler is called within the Bctu_Ip_Bctu0Fifo1DmaComplete function. Thus, the DMA hardware request is refreshed.

BrK__8-1695725408983.png

 

What I want to ask here is who calls the Bctu_Ip_Bctu0Fifo1DmaComplete function and when. Could it be related to my problem?

What am I missing so that DMA can work and an interrupt occurs in the DMA major loop?

0 Kudos
Reply
1 Solution
4,081 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

did you call BCTU init after DMA init? BCTU init configures selected DMA ch TCD, so it can be cleared by DMA init.
I posted working example at https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K344-PIT-BTCU-parallel-ADC-FIFO-DMA-DS3-...
Hope it helps.

BR, Petr

View solution in original post

8 Replies
4,254 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi

if you perform parallel conversions, in your case trigger 2 ADCs per single BCTU trigger, then you have to config list to have 2, 4, 6, ... items. Then set DMA transfer accordingly.

What is the S32DS and RTD version you are using?

BR, Petr 

0 Kudos
Reply
4,249 Views
BrK_
Contributor III

Hi @PetrS,

RTD version: 3.0.0 and S32DS version: 3.5

BrK__0-1695733633415.png

So even if I have 5 channels, I must also configure the 6th channel for it to work properly, am I right?.

BCTU makes the DMA transfer configurations, do I need to do it again manually?

0 Kudos
Reply
4,210 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, you should have 6 channels in BCTU list.
Not sure in RTD3.0.0 but in previous DMA must be configured manually.
Let me create some project in RTD3.0.0 to meet your config.

BR, Petr 

0 Kudos
Reply
4,196 Views
BrK_
Contributor III

Hi @PetrS ,

Is there any news from the BCTU DMA side.

BR.

0 Kudos
Reply
4,173 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

per my understanding as BCTU configures the DMA TDC for specified channel and make DREQ cleared, as you wrote, you will need to enable DMA channel interrupt in code, and put Bctu_Ip_Bctu0Fifo1DmaComplete as interrupt callback within DMA setting. 

BR, Petr

0 Kudos
Reply
4,129 Views
BrK_
Contributor III

Hi @PetrS ,

When I tried to debug mode, I got a Source Bus Error in the eDMA ES (error status) register.

Does it need permission to access the SRAM of the DMA module? If it has how can I do that?

0 Kudos
Reply
4,082 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

did you call BCTU init after DMA init? BCTU init configures selected DMA ch TCD, so it can be cleared by DMA init.
I posted working example at https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K344-PIT-BTCU-parallel-ADC-FIFO-DMA-DS3-...
Hope it helps.

BR, Petr

4,167 Views
BrK_
Contributor III

Hi @PetrS ,

I tried this way, but I still couldn't run the dma major interrupt. Have you tried this, and if so can you share an example?

0 Kudos
Reply