From 822491ef7a32957b04d25e26332bc04927a060e6 Mon Sep 17 00:00:00 2001 From: Michael Perkins <157516771+perkinsmg@users.noreply.github.com> Date: Tue, 24 Sep 2024 16:46:36 +0100 Subject: [PATCH] fix(PeriphDrivers): Don't cache TMR clock frequency if locked (#1188) Signed-off-by: Michael Perkins --- Libraries/PeriphDrivers/Source/TMR/tmr_revb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Libraries/PeriphDrivers/Source/TMR/tmr_revb.c b/Libraries/PeriphDrivers/Source/TMR/tmr_revb.c index 8b495388ee..3306d2b05f 100644 --- a/Libraries/PeriphDrivers/Source/TMR/tmr_revb.c +++ b/Libraries/PeriphDrivers/Source/TMR/tmr_revb.c @@ -182,6 +182,11 @@ void MXC_TMR_RevB_SetClockSourceFreq(mxc_tmr_revb_regs_t *tmr, int clksrc_freq) (void)tmr_id; MXC_ASSERT(tmr_id >= 0); + // If the clock source is locked, don't update the frequency either, as we will + // have rejected the configuration update too in MXC_TMR_RevB_SetClockSource. + if (g_is_clock_locked[tmr_id]) + return; + tmr_clksrc[tmr_id].configured = true; tmr_clksrc[tmr_id].freq = clksrc_freq; }