Trigger ADC twice through PDB in one PWM cycle on s32k144

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

Trigger ADC twice through PDB in one PWM cycle on s32k144

Jump to solution
685 Views
zhangchun
Contributor III

Hello,

I am working on a motor control project and in order to optimize the control, I now need to trigger ADC twice within a PWM cycle for sampling. Specifically, this is the case.

 

ADC0_ Ch4 and ADC1_ CH15 is converted at the time when the PDB starts counting, and after the conversion is completed, an ADC1 interrupt is generated to read ADC data within the interrupt.

The period value [ticks] of PWM is 5000, and when the PDB count reaches 1500, ADC1_ Ch0 starts the conversion, and when the PDB count reaches 2500, ADC0_ Ch4 and ADC1_ CH15 starts the conversion, and after the conversion is completed, an ADC0 interrupt is generated to read ADC data within the interrupt. The triggering process is shown in the following figure

img_v2_d27d4b39-6d6c-4a99-b140-21635c995e1g.jpg

Currently, adding a second trigger sampling will result in both triggers failing. Please help me

 

thanks

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
657 Views
zhangchun
Contributor III
Resolved, the frequency of ADC needs to be increased. There are two incorrect variable names in the attached project.
Thanks

View solution in original post

0 Kudos
Reply
2 Replies
672 Views
zhangchun
Contributor III
The reason why ADC0 and ADC1 interrupts are used here is because if ADC1 interrupts are all used, I am not sure how to distinguish which trigger sampling point this PWM cycle is. If it could be distinguished within the interrupt, it would be a better choice
0 Kudos
Reply
658 Views
zhangchun
Contributor III
Resolved, the frequency of ADC needs to be increased. There are two incorrect variable names in the attached project.
Thanks
0 Kudos
Reply