Possible to continuously ADC sample only during active phase of PWM? (STM32F466RE)
I'm using an STM32F466RE to drive a motor via PWM and want to sample a current monitor via ADC during the active part of the pulse so that I can integrate the amount of power delivered to the motor. This will require the sample rate to be high enough to obtain samples during the minimum pulse witdth (1/100 of PWM period) and what I'd like is to prevent the ADC from capturing wasted samples during the off part of the pulse since that would just be a heap of zeroes that need to be integrated.
Is there any way to configure the device so that continuous ADC sampling is gated by the state of the PWM output? Or will I have to sample continuously and figure out what to ignore?
At the moment I'm planning on driving the PWM at ~500Hz, sampling at ~50kHz, and using the calculated power in a control loop updated at maybe ~50Hz.
