From 616705b7e5086c8d9920f356433b78d2c39160cc Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Mon, 19 Sep 2022 22:18:45 -0400 Subject: [PATCH] h1r9: don't write to outputs in TIMER3 ext. match register Writing to the output bits in the TIMER3 external match register resulted in intermittent failures that varied in likelihood from board to board and from commit to commit for no apparent reason. --- firmware/common/clkin.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/firmware/common/clkin.c b/firmware/common/clkin.c index bef8b8a9..080d02d0 100644 --- a/firmware/common/clkin.c +++ b/firmware/common/clkin.c @@ -52,8 +52,7 @@ void clkin_detect_init(void) timer_set_prescaler(TIMER3, 0); timer_set_mode(TIMER3, TIMER_CTCR_MODE_TIMER); TIMER3_MCR = TIMER_MCR_MR0R; - TIMER3_EMR = TIMER_EMR_EM0 | TIMER_EMR_EM3 | - (TIMER_EMR_EMC_SET << TIMER_EMR_EMC0_SHIFT) | + TIMER3_EMR = (TIMER_EMR_EMC_SET << TIMER_EMR_EMC0_SHIFT) | (TIMER_EMR_EMC_TOGGLE << TIMER_EMR_EMC3_SHIFT); TIMER3_MR3 = MEASUREMENT_CYCLES; TIMER3_MR0 = MEASUREMENT_CYCLES;