S32K118 ADC multiple channel conversion with PDB

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

S32K118 ADC multiple channel conversion with PDB

跳至解决方案
513 次查看
zubizeratta
Contributor II

Hello,
I am trying to read the voltages of 7 channels with ADC and PDB modules. (S32K118 , RTD Drivers).

I have checked the previous discussions on similar topic but there are still some points are not clear to me:

1 - I see from the reference manual that S32K118 doesn't have the PDB back-to-back functionality. Does it mean that I can't use PDB to trigger conversion on multiple channels automatically? 

2 - What is the most practical way of triggering conversions for multiple channels and only get notified (could be polling of the flag or interrupt) when the values are there in the result registers? 

3- Even If I don't need any delays between conversions, should I still use PDB? 

I can set up an interrupt driven mechanism to change the channel every time but I am looking for the most efficient way by using the PDB peripheral. I checked "Hardware trigger" ADC example but it's just for 1 channel. 

标记 (3)
0 项奖励
回复
1 解答
422 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

first pretrigger must use delay, either small one or delay can be bypassed (specified by CHnC1[TOS] bit), but cannot have back-to-back option (CHnC1[BB] bit) set otherwise will not be triggered.
SW trigger just start PDB counter.

PetrS_0-1717653936962.png

if BB is set then TOS is going to be ignored.

So your setting for pretriggers in back-to-back chain can be 
- all have Enable the pre-trigger option set (EN bit), Enable pre-trigger output unchecked (TOS bit)
- enable pre-trigger back-to-back mode for all except first one

BR, Petr

在原帖中查看解决方案

0 项奖励
回复
5 回复数
454 次查看
zubizeratta
Contributor II

Thanks. 

I am checking the app-not but still I have some questions: 

- For setting 7 channels, still am I able to use first 4 channels for PDB back-to-back mode or Should I start from channel 4 to configure all 7 channels? 

- Which configuration I should use for the adc-trigger configuration of PDB? (Enable the pre-trigger, Enable pre-trigger output, enable pre-trigger backto back mode) 

- Even I don't need any delay and I want to trigger the conversions as soon as the previous one finished, should I still set the mod and delay registers? (PDB_DRV_SetAdcPreTriggerDelayValue(),PDB_DRV_SetTimerModulusValue() )

- As far as I see that all examples are registered based . Are there any examples with SDK functions?.

0 项奖励
回复
447 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

- one PDB channel with 8 pretriggers can trigger 8 ADC channels. If using back-to-back chain first pretrigger must be started using a delay, rest use back-to-back option.
- All used pretriggers will have options Enable the pre-trigger, Enable pre-trigger output, enable pre-trigger backto back mode just for channels not using a delay.
- first channel must use a delay. Modulus must be higher then a delay used and if continuous operation is set then modulus must be set to have time longer than all triggered conversion in a chain.
- some SDK example is given in e.g. 
https://community.nxp.com/docs/DOC-343295
https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K148-PDB0-PDB1-ring-S32DS3-4-RTM4-0-3/ta...
Not sure of RTD example, simple one is available in RDT directly.

BR, Petr

0 项奖励
回复
438 次查看
zubizeratta
Contributor II

Thanks it's almost clear for me now, only thing is that I want to understan why we still need delay for first channel since I will not be using continuous mode. The scenario I am implementing is : 

APP --> PDB SW Trigger -- > Triggers the ADC ch0

End of Conv CH0 --> Triggers the ADC ch1

End of Conv CH1 --> Triggers the ADC ch2

...

...

End of Conv6 --> Triggers the last ADC chan / CH7 and stops

Do I still need to set up a delay or is there a way to start the first conversion right away? 

0 项奖励
回复
423 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

first pretrigger must use delay, either small one or delay can be bypassed (specified by CHnC1[TOS] bit), but cannot have back-to-back option (CHnC1[BB] bit) set otherwise will not be triggered.
SW trigger just start PDB counter.

PetrS_0-1717653936962.png

if BB is set then TOS is going to be ignored.

So your setting for pretriggers in back-to-back chain can be 
- all have Enable the pre-trigger option set (EN bit), Enable pre-trigger output unchecked (TOS bit)
- enable pre-trigger back-to-back mode for all except first one

BR, Petr

0 项奖励
回复
491 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

back to back chain within PBD channel is supported on S32K118 as well. There is no possibility to do PDB back-to-back chain forming PDB0-PDB1 ring.
So using PDB with back-to-back option is best way to do multiple conversions.
You can refer to AN12217 S32K1xx ADC guidelines, spec and configuration chapter 4.3. PDB trigger in back-to-back mode for more info and very basic code.
https://www.nxp.com/docs/en/application-note/AN12217.pdf

BR, Petr

 

0 项奖励
回复