aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/xWDGv1
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-12-03 14:44:18 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-12-03 14:44:18 +0000
commitc1e7f8c6c794ca40f99cf4b9a42f3787f5131909 (patch)
treec8478c70cb7a70f03d86f7191218502bbccc1e42 /os/hal/ports/STM32/LLD/xWDGv1
parentc39cfd28fde675337563eb87417458aa28a83db4 (diff)
downloadChibiOS-c1e7f8c6c794ca40f99cf4b9a42f3787f5131909.tar.gz
ChibiOS-c1e7f8c6c794ca40f99cf4b9a42f3787f5131909.tar.bz2
ChibiOS-c1e7f8c6c794ca40f99cf4b9a42f3787f5131909.zip
WDG driver works, update of all registries, halconf.h and mcuconf.h to be performed.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8557 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/STM32/LLD/xWDGv1')
-rw-r--r--os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.c b/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.c
index bdcfb383a..8ea82a958 100644
--- a/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.c
+++ b/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.c
@@ -81,19 +81,33 @@ void wdg_lld_init(void) {
*/
void wdg_lld_start(WDGDriver *wdgp) {
- /* Unlock IWDG.*/
+#if 1
+ /* Enable IWDG and unlock for write.*/
+ wdgp->wdg->KR = KR_KEY_ENABLE;
wdgp->wdg->KR = KR_KEY_WRITE;
/* Write configuration.*/
wdgp->wdg->PR = wdgp->config->pr;
wdgp->wdg->RLR = wdgp->config->rlr;
+ while (wdgp->wdg->SR != 0)
+ ;
+
+ /* This also triggers a refresh.*/
wdgp->wdg->WINR = wdgp->config->winr;
+#else
+ /* Unlock IWDG.*/
+ wdgp->wdg->KR = KR_KEY_WRITE;
+
+ /* Write configuration.*/
+ wdgp->wdg->PR = wdgp->config->pr;
+ wdgp->wdg->RLR = wdgp->config->rlr;
while (wdgp->wdg->SR != 0)
;
/* Start operations.*/
wdgp->wdg->KR = KR_KEY_RELOAD;
wdgp->wdg->KR = KR_KEY_ENABLE;
+#endif
}
/**