This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

recommend method for initiating reset from software

Other Parts Discussed in Thread: AM1808

On the AM1808, what is the recommend method for initiating a reset via software? Hard reset would be preferable. The goal is for the boot loader (in SPI flash) to execute. I tried branching to address zero, but it didn't work, possibly because the interrupt vectors are remapped. Is it necessary to program the watchdog and/or the PSC, or is there a more direct way? I'm currently using LogicPD's eval board.

Best regards,

Chris

  • I answered my own question though it took me a while. I enclose my solution so hopefully no one will ever worry about this again!


    #include "evmam1808.h"
    #include "evmam1808_timer.h"

    #define    WDEN    0x00004000
    #define    WDKEY1    0xA5C60000
    #define    WDKEY2    0xDA7E0000

    void Reboot()
    {
        // might want to mask all interrupts first...
        TMR1->GPINT_GPEN = 0;
        TMR1->GPDATA_GPDIR = 0;
        TMR1->INTCTLSTAT = 0;
        TMR1->EMUMGT = 0;
        TMR1->TGCR = 0;        // reset
        TMR1->TCR = 0;        // reset
        TMR1->TGCR = TIMMODE_64BIT_WDOG;    // set watchdog mode
        TMR1->TIM12 = 0;    // zero initial count
        TMR1->TIM34 = 0;   
        TMR1->TGCR |= TIM34RS | TIM12RS;    // unreset
        TMR1->PRD12 = 0;    // zero period for immediate reset
        TMR1->PRD34 = 0;
        TMR1->WDTCR = WDKEY1 | WDEN;    // make watchdog pre-active
        TMR1->WDTCR = WDKEY2 | WDEN;    // make watchdog active
    }

  • Chris Korda said:

    I answered my own question though it took me a while. I enclose my solution so hopefully no one will ever worry about this again!


    #include "evmam1808.h"
    #include "evmam1808_timer.h"

    #define    WDEN    0x00004000
    #define    WDKEY1    0xA5C60000
    #define    WDKEY2    0xDA7E0000

    void Reboot()
    {
        // might want to mask all interrupts first...
        TMR1->GPINT_GPEN = 0;
        TMR1->GPDATA_GPDIR = 0;
        TMR1->INTCTLSTAT = 0;
        TMR1->EMUMGT = 0;
        TMR1->TGCR = 0;        // reset
        TMR1->TCR = 0;        // reset
        TMR1->TGCR = TIMMODE_64BIT_WDOG;    // set watchdog mode
        TMR1->TIM12 = 0;    // zero initial count
        TMR1->TIM34 = 0;   
        TMR1->TGCR |= TIM34RS | TIM12RS;    // unreset
        TMR1->PRD12 = 0;    // zero period for immediate reset
        TMR1->PRD34 = 0;
        TMR1->WDTCR = WDKEY1 | WDEN;    // make watchdog pre-active
        TMR1->WDTCR = WDKEY2 | WDEN;    // make watchdog active
    }

    Thanks Chris,

    I'm going to keep that in mind for our project, although so far I find that using the LINUX "reboot" command seems to work on the AM1808evm board OK.

  • this is the common way to do this to trigger watch dog reset the cpu.. 

    might put a while (1); dead loop at the end of the function.