From 33e7bb7f66bc7c97834e32d285faac492414b716 Mon Sep 17 00:00:00 2001 From: SemvdH <45453592+SemvdH@users.noreply.github.com> Date: Fri, 27 Oct 2023 09:43:01 +0200 Subject: [PATCH] Update obd2_timer.c, add comment about clearing status register added reference to datasheet section 13.4 --- due_obd2/obd2_timer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/due_obd2/obd2_timer.c b/due_obd2/obd2_timer.c index 4f5b5c6..d5d7f67 100644 --- a/due_obd2/obd2_timer.c +++ b/due_obd2/obd2_timer.c @@ -20,7 +20,9 @@ void obd2_timer_reset() */ /* disable interrupts */ RTT->RTT_MR &= ~RTT_MR_ALMIEN; - /* clear the status register */ + /* clear the status register (reading it clears it) + SAM3X datasheet section 13.4: Reading the RTT_SR status register resets the RTTINC and ALMS fields. + */ RTT->RTT_SR; /* set the alarm value to 0*/ RTT->RTT_AR = 0; @@ -29,4 +31,4 @@ void obd2_timer_reset() /* reset the RTT*/ RTT->RTT_MR |= RTT_MR_RTTRST; -} \ No newline at end of file +}