From 4ca2d1ac5b2b74a4e68274fba8b03005d22e9d8f Mon Sep 17 00:00:00 2001 From: Konstantin Begun Date: Thu, 23 Feb 2017 01:02:06 +0000 Subject: [PATCH] Set prescaler divisor (cs_div_value) to zero when prescaler is reset, i.e. timer is stopped. Otherwise when OCR is set, the tomer gets reconfigured with the old prescaler --- simavr/sim/avr_timer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/simavr/sim/avr_timer.c b/simavr/sim/avr_timer.c index a1c2b4f..81131a1 100644 --- a/simavr/sim/avr_timer.c +++ b/simavr/sim/avr_timer.c @@ -662,6 +662,7 @@ avr_timer_write( if (new_cs != cs || new_mode != mode || new_as2 != as2) { /* cs */ if (new_cs == 0) { + p->cs_div_value = 0; // reset prescaler // cancel everything avr_timer_cancel_all_cycle_timers(avr, p, 1); -- 2.39.5