I'm using MCPWM api to control a motor driver DRV8701 and i need to ADC sample the motor current but only during the PWM ON phase. - Is there a way i can trigger an ADC read based on the PWM phase and only read ADC while the PWM is on the ON phase?
- Is there any way i can do this using the ADC continues sampling?
Thanks
Sample ADC while PWM ON phase using MCPWM
Re: Sample ADC while PWM ON phase using MCPWM
Not really easily on older chips... however, everything from the C6 on has the event-task system that should make this a lot easier.
-
MicroController
- Posts: 2661
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Sample ADC while PWM ON phase using MCPWM
Can you sample continuously and filter for 'interesting' samples in software? E.g. ignore all values < 10mA and take the average of all other values, or take the maximum value from an X ms period?
Re: Sample ADC while PWM ON phase using MCPWM
Yes, this is what i'm currently doing and i was looking to improve this.Can you sample continuously and filter for 'interesting' samples in software? E.g. ignore all values < 10mA and take the average of all other values, or take the maximum value from an X ms period?
Another way i was thinking to deal with this is to wire the PWM out pin to another input pin and trigger an ADC read in an interrupt but i don't think triggering ADC in interrupts is a good idea.
Who is online
Users browsing this forum: Applebot, Bytespider, ChatGPT-User, PerplexityBot, Qwantbot, Semrush [Bot] and 6 guests
