Trigger ADC twice through PDB in one PWM cycle on s32k144

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

Trigger ADC twice through PDB in one PWM cycle on s32k144

跳至解决方案
1,334 次查看
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

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,306 次查看
zhangchun
Contributor III
Resolved, the frequency of ADC needs to be increased. There are two incorrect variable names in the attached project.
Thanks

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,321 次查看
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 项奖励
回复
1,307 次查看
zhangchun
Contributor III
Resolved, the frequency of ADC needs to be increased. There are two incorrect variable names in the attached project.
Thanks
0 项奖励
回复