Question
STM32L4 Timer OCxREF reset, Toogle and Gated Mode questions
Hi,
On a STM32L476 MCU, I use many timers with various synchronization / outputs combination. I've two problems still remaining :
- On TIM3, the Channel 4 Output compare mode TOOGLE do not seems to work correctly (the GPIO do not toogle, it simply goes from low to high when the timer after the first OC match after the timer is started) although the timer channel is correctly configured because the ADC is correctly clocked from the same timer channel OC match. The same code on the Channel 1 of this timer works (the only one difference is that the channel 1 is not used as trigger input for the ADC block)
- One of the other timers (TIM2 or TIM5, I don't have code right now) configured in gated mode, I'd like to reset the OCxREF of one channel to ensure that this channel output (configured in output compare toogle mode) always start from the same state. I tried to set the output compare mode to 'Force Inactive Level' or 'Force Active Level' but it does not work. The reference manual p1036 says that this can be used to force the OCxREF independantly of the output compare registers and counter. However, this do not seems to work on my software. Does it still work when the timer is 'not running' (i.e when the timer is not gated) ?
- One last question about gated timers. I'd like to be able to inform upper layers of my software when the trigger interrupt hit, with the counter enable status. In the interrupt handler, I read the content of the CR1 register, but the CEN bit is always set to 1 (which is a requirement for the gated mode to work as specified in reference manual p1061. Is there any way to have the 'real' state of the timer ?
Regards, Jerome