STM8S105C6 - TIM2, TIM4 NOT working, not incrementing, TIM1 - ok
I'm trying to "activate" TIM2 or TIM4 on a STM8S105C6 (discovery board) part without success for more than 4 days now... I'm getting sooo frustrated.
I tried all examples I could find and not a single one works.
Ended up with a basic, dummy test to show the issue. Just enable ti timer and "watch" the counter register - it is NOT incrementing, consequently nothing works.
It's the same with TIM2.
But TIM1 works normally.
TIM2 & TIM4 cout registers just won't update/change.
Any idea what could be possibly wrong?
I tried with 5 different boards (always the same model, STM8S Discovery with S105C6 onboard)
void main(void) {
int cnt;
TIM4_IER = 0; // 0x01;
TIM4_EGR = 0x01;
TIM4_PSCR = 0x01;
TIM4_ARR = 0x10;
TIM4_CNTR = 0xff;
TIM4_CR1 = 0x01;
while (1) {
for (cnt=0;cnt<1000;cnt++) ;
printf("tim4: %u", TIM4_CNTR); // always prints tim4: 0
for (cnt=0;cnt<333;cnt++) ;
printf("tim4: %u", TIM4_CNTR); // always print tim4: 0
}
}