You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by be...@apache.org on 2020/12/18 23:34:13 UTC

[mynewt-core] branch master updated: hw/mcu/dialog: Fix watchdog init when using RCX

This is an automated email from the ASF dual-hosted git repository.

benmccrea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new df96df0  hw/mcu/dialog: Fix watchdog init when using RCX
     new 99d11be  Merge pull request #2447 from supervillain101/dialog_watchdog_lpclk_fix
df96df0 is described below

commit df96df01c1225caa4d875400c33498b61efd595a
Author: Philip Burkhardt <ph...@juul.com>
AuthorDate: Fri Dec 18 12:35:53 2020 -0800

    hw/mcu/dialog: Fix watchdog init when using RCX
    
    RCX oscillator runs at 15kHz.  Watchdog initialization did not account
    for both RCX and EXT 32kHz oscillators when calculating WDT init value.
---
 hw/mcu/dialog/da1469x/src/hal_watchdog.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/mcu/dialog/da1469x/src/hal_watchdog.c b/hw/mcu/dialog/da1469x/src/hal_watchdog.c
index ba606c5..c8e07fb 100644
--- a/hw/mcu/dialog/da1469x/src/hal_watchdog.c
+++ b/hw/mcu/dialog/da1469x/src/hal_watchdog.c
@@ -29,7 +29,11 @@ hal_watchdog_init(uint32_t expire_msecs)
     SYS_WDOG->WATCHDOG_CTRL_REG = SYS_WDOG_WATCHDOG_CTRL_REG_WDOG_FREEZE_EN_Msk;
     GPREG->SET_FREEZE_REG |= GPREG_SET_FREEZE_REG_FRZ_SYS_WDOG_Msk;
 
+#if MYNEWT_VAL_CHOICE(MCU_LPCLK_SOURCE, RCX)
+    g_hal_watchdog_reload_val = expire_msecs / 21;
+#else
     g_hal_watchdog_reload_val = expire_msecs / 10;
+#endif
     assert((g_hal_watchdog_reload_val & 0xFFFFC000) == 0);
 
     while (SYS_WDOG->WATCHDOG_CTRL_REG & SYS_WDOG_WATCHDOG_CTRL_REG_WRITE_BUSY_Msk) {