1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

initializes watchdog properly for MSB-A2

It the watchdog does not reset the WDMOD, BSL pin remains ignored.
This commit is contained in:
Oleg Hahm 2013-11-25 16:51:18 +01:00
parent f8c8bc8ee6
commit 749a24c515
3 changed files with 12 additions and 15 deletions

View File

@ -51,6 +51,8 @@ and the mailinglist (subscription via web site)
#define PCRTC BIT9
#define CL_CPU_DIV 4
#define WD_INTERVAL 10 ///< number of seconds before WD triggers
/*---------------------------------------------------------------------------*/
/**
* @brief Enabling MAM and setting number of clocks used for Flash memory fetch
@ -85,8 +87,17 @@ void init_clks2(void)
while (!(PLLSTAT & BIT25));
}
void watchdog_init(void)
{
WDCLKSEL = 0; // clock source: RC oscillator
WDMOD &= ~WDTOF; // clear time-out flag
WDTC = (F_RC_OSCILLATOR / 4) * WD_INTERVAL;
}
void bl_init_clks(void)
{
watchdog_init();
PCONP = PCRTC; // switch off everything except RTC
init_clks1();
init_clks2();

View File

@ -89,17 +89,3 @@ void thread_print_stack(void)
printf("STACK (%u)= %X \n", i, *s);
}
/* LPC specific */
#ifdef WDTC
__attribute__((naked,noreturn)) void arm_reset(void)
{
dINT();
WDTC = 0x00FFF;
WDMOD = 0x03;
WDFEED = 0xAA;
WDFEED = 0x55;
while (1);
}
#endif

View File

@ -15,7 +15,7 @@
__attribute__((naked,noreturn)) void arm_reset(void)
{
disableIRQ();
WDTC = 0x00FFF;
WDTC = 0x0FFFF;
WDMOD = 0x03;
WDFEED= 0xAA;
WDFEED= 0x55;