2016-03-21 03:50 PM
Hello there,
I was wondering either in STM32F4 it is possible, to get a similar functionality to C2000 one, that can trigger an ADC conversion after certain counter valueon a timer is reached, like here:https://www.dropbox.com/s/d6lonep1m3i5x4d/Zrzut%20ekranu%202016-03-21%2023.48.06.png?dl=0
(point CA, middle). In stm34f4 I am using center aligned pwm mode. I can trigger ADC each time timer starts counting up/down or both. But I need to trigger the adc when the counter is halfway down or up. Is there a way to do this? I would appreciate all help. #timer #adc #synchronization2016-03-21 04:59 PM
If you have a spare channel in your timer, and that associates with one of the ADC triggers, then you should be able to set the CCR for the desired count, and that should fire each time it passes.
2016-03-21 11:15 PM
Thank you for help. I dont have one but i will try to get one.
2016-03-22 12:18 AM
But is there really no way to make the counter count like this maybe?
https://www.dropbox.com/s/iw9gcw9kplbkg8n/Zrzut%20ekranu%202016-03-22%2008.18.08.png?dl=0
2016-03-22 03:06 AM
I thought that is how pwm centred worked, but not really a timer mode or function I've got much use for.
2016-03-22 03:50 AM
I thought this as well! But the counter overflow interrupts are generated at the end of pulses...
2016-03-22 06:09 AM
Ok, but doesn't the timer provide an underflow/overflow indicator so you know which way it was counting?
I suspect you'll need to do some evaluation of what the counter is actually doing.2016-03-22 06:23 AM
In center aligned pwm mode 3 I can generate interrupts each timer counter starts counting up and down. So it looks like this:
[[this link/image has been flagged as malicious by our security scan software and has been deleted]] With RED color i have drawn the counters levels. Red dots are interrupts. As you see I can generate OC interrupts only at the edges, not in the middle, because the counter doesnt stop/ start in the middle...2016-03-22 08:11 AM
Is there a way to change this behaviour to get interrupts in the middle so they can fire ADC?
2016-03-22 08:43 AM
Sorry, I don't know...
The Update should fire at CNT=0The Up/Down counter should go 22, 23, 24, 23, 22, .. In which case I'd suspect setting CCR to 24 would have the channel fire at the peak value.