2018-11-24 02:42 AM
Hello, how can I detect encoder overflow on STM32F767? I want to increment a variable every time the encoder overflows. Thank you, Vaclav
2018-11-24 01:25 PM
You'd likely need to interrupt on the Update condition (ie CNT==0) or use the other CCRx to flag as it approaches limits. (ie CNT==CCR2, CC2 signals)
TIM2 and TIM5 should be 32-bit
2018-11-24 03:32 PM
There is no simplistic solution of this problem. Don't get caught by the trap of trying to rely solely on Update interrupt, you'll miss reversals. Instead, make sure that you'll read out the counter at least twice per revolution (for example using the update and two compare interrupts set at 1/3 and 2/3 of the full revolution, disabling themselves upon firing to avoid interrupt storm upon reversals, while re-enabling the other two) and write the logic needed to decode overflows from that. User reads should go through the same logic, paying meticulous attention to atomicity.
JW