How can I programmatically reboot a NETARM device? Cheers, Minlin
I am replying myself just in case others might need to know. I found out NETOS6 has a API function “customizeReset” that will do it.
The actual way that the default customizeReset is to enable the watchdog and configure it to generate a hardware reset so if your program uses the watchdog and “feeds” it this routine will probably not generate a reset. Note also that the default watchdog-timeout configured by this routine is the maximum so the actual reset will no be generated for 2^25/FXTALE seconds which should be taken into account.
How can I set the watchdog-timeout to 1 second so that customizeReset immediately resets the unit?
Currently when I call customizeReset() nothing happens.
I found this code, but I don’t understand it:
narm_write_reg(NARM_GSCR_REG, NARM_GSCR_ADDR, swt, 2); /* time out period is (2**24)/F_XTAL */ narm_write_reg(NARM_GSCR_REG, NARM_GSCR_ADDR, swri, 2); /* program watch dog to create reset*/ narm_write_reg(NARM_GSCR_REG, NARM_GSCR_ADDR, swe, 1); /* enable the watchdog timer circuit*/
I managed to reboot the unit with the following code:
static TX_TIMER resetTimer;
static void reset(ULONG notUsed)
customizeReset(); /* reset*/
tx_timer_create (&resetTimer, “Reset Timer”, reset, NOT_USED, DELAY_BEFORE_RESET, NOT_USED, TX_AUTO_ACTIVATE);