2013-08-27 02:24 AM
Hello,
I'm currently working on a brushless motor control application and i'm in the process of implementing the current measuring of the three phases. In order to do so, I need to synchronise the ADC sampling with the PWM outputs in order to sample at the center of the PWM outputs (center aligned 2 mode).Unfortunately cannot find a simple solution. From the datasheet i see that the ADC can be trigger by either the CC1-4 timer interrupts or the TRGO interrupt. However, from what i've read, the interrupt that that the ADC needs to trigger off of is the timer update interrupt (which is not in the list of available ADC triggers external triggers).Am i understanding this correctly? I was expecting a straightforward solution as this is a common problem in any motor control application, which is one of the mains features of the advanced timers.Thanks,Alex #stm3-adc-trigger2019-01-08 11:23 AM
200 samples collected at 200 KHz (5us) will take 1ms (1 KHz)
Toggling a pin every 1ms (1 KHz) results in a PERIOD of 2ms (500 Hz)
500ms is a timing you've pulled out of the air
2019-01-09 12:12 PM
Thank you @Community member
Well, if I use a pwm timer whose 50% duty, does it mean that half complete callback is only High or Low state?
2019-01-09 12:49 PM
The TIM triggers the ADC, the ADC EOC triggers the DMA
The DMA generates an interrupt when it's buffer reaches its half way point, and at the end point
HT - HALF TRANSFER
TC - TRANSFER COMPLETE
The phase/duty of the TIM isn't consequential here. The ADC triggers on the leading edge, ie CNT==0 for UPDATE, or CNT==CCR1 for CC1
2019-01-10 11:35 AM
Hımm.
Well, to measure the adc value according to ON/OFF state of that PWM, must the adc be trigged by another TIM?