S32K118 how to read all 16 ADC channels

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

S32K118 how to read all 16 ADC channels

1,555 Views
janireunanen
Contributor I

Hi,

I am creating a software for S32K118 (S32 Design Studio 2018.R1 in Windows 10) and one part of it requires reading ADC inputs.
Seems that S32K118 has only one ADC unit (ADC0) and one PDB unit (PDB0), this ok.
But the problem is how to actually read all those 16 ADC.

I have tried to using the ADC PDB back-to-back mode.
So when ADC0-ch0 is first SW triggered and its measurement is completed, it will trigger ADC0-ch1 and so on up to ADC0-ch7.
How do I now continue reading the rest, ADC0-ch8 to ADC0-ch15?

I been reading "S32K1xx Series Reference Manual S32K1XXRM, Rev 11. 06/2019", but it's not quite clear how to do this.
Not sure is it even possible to link all this 16 together, or is it only possible to link 2 different loops of 8 channels.

Preferred way for me would be
1) SW trigger the loop
2) when loop of 16 channels have finished measurement, then ADC_IRQ is triggered
3) read all 16 channels result inside the ADC_IRQ
4) re-trigger this full 16 channel again (with some function in coder or automatically as in "continuous mode", both ways are ok)

Attachment pdb-01: this loop looks good (S32K1xx Manual, page 1166), but there are PDB0 and PDB1, and S32K118 seem to have only PDB0?
Attachment pdb-02, 03, 04: PDB configuration

0 Kudos
3 Replies

1,388 Views
janireunanen
Contributor I

I was now able to get it working.

Both PDB0 ch0 and ch1 now in use and with correct delay values.

Source code became cleaner and most important, it works perfectly.

Thank you very much for quick help!

0 Kudos

1,388 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you would need to configure back-to-back chain on PDB0 ch1 too, but the ch1 pretrigger 0 must be delayed (using CH1DLY0) to be happen after chain on ch0 is finished. 

You can refer to https://community.nxp.com/docs/DOC-343295 for this configuration.

Hope it helps.

BR, Petr

1,344 Views
xzj666
Contributor I

I dont't konw the reason that config all of the ADC pin as exit12,is it useful?

0 Kudos