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.

TM4C123GH6PM: Tiva C

Part Number: TM4C123GH6PM


Hi,

I'm trying to initialize Watchdog Timer 1. I'm using the default clock source

SYSCTL_RCGCWD_R=0x00000002;         // Run Mode Clock Gating Control for WDT1

while(!(SYSCTL_RCGCWD_R & 0x00000002)) ;

WATCHDOG1_LOCK_R= 0x1ACCE551;                           //Statement 1

//Or

WATCHDOG1_LOAD_R = 67108864;                               //Statement 2

Statement 1 causes Hard Fault. If I commented , then  statement 2 causes Hard Fault. Anyone knows the cause?

Thanks



  • Hi,

      First of all, you are using DRM (direct register manipulation) method to program the MCU. This is prone to mistakes. I will strongly suggest you to use TivaWare library to develop your application. We normally do not support reviewing DRM style of coding. Please see FAQ about this. 

      A couple things for you to check. 

      1. Is SYSCTL_RCGCWD_R correctly mapped to 0x400FE600?

      2. Do you have the same problem if you were to use WD0

      3. I don't see you poll the WRC bit before accessing the WD1 registers. Please see below.

  • The register address are correct.

    WD Timer 0 works fine.

    I inserted additional  the time after gating the clock to WDT1 module.

    Then even I tried to read the lock register instead of writing. The same problem, Hard Fault. 

  • Hi,

      Looks like you are hitting one of the Watchdog errata. Please refer to the errata document for details. http://www.ti.com/lit/er/spmz849f/spmz849f.pdf You must implement a workaround by enabling another peripheral such as UART1 or SSI1 first before enabling the WD1.

  • I enabled UART0 then I enabled WDT1, that was the solution for hard fault.

    However RESEN it doesn't work the way stated in the manual. My experiment:

    WDT1:

    RESEN :0

    When interrupt occurred and I cleared INT flag------> no reset occurred and the interrupt repeated itself periodical ( set for 4 sec) 

    When interrupt occurred and I ignored INT flag------> reset occurred  from the first time.

    RESEN :1

    When interrupt occurred and I cleared INT flag------> no reset occurred and the interrupt repeated itself periodical ( set for 4 sec) 

    When interrupt occurred and I ignored INT flag------> reset occurred  from the first time.

    WDT0:

    RESEN :0

    When interrupt occurred and I cleared INT flag------> no reset occurred and the interrupt repeated itself periodical ( set for 4 sec) 

    When interrupt occurred and I ignored INT flag------> reset occurred  from the first time and hang

    RESEN :1

    When interrupt occurred and I cleared INT flag------> no reset occurred and the interrupt repeated itself periodical ( set for 4 sec) 

    When interrupt occurred and I ignored INT flag------> reset occurred  from the first time.

    Question regarding shared interrupt handler:

    When two interrupts sharing one handler, should I disable their NVI interrupt, then examine the status flag for both? Because if

    I examine the status register to determine which flag to clear, the interrupt keeps firing?

    I disabled their NVI at the entry of the ISR, then I enabled it  before an exit , that didn't give me good result.

    Therefore, how do you determine which one occurred ?

    Thanks.

     

  • Hi,

      Looks like you are hitting another errata regarding the RESEN in WD1. Please see below description

    . I will suggest you go through all the errata so you have the workarounds in place. 

    What is your application that requires two different WD at the same time. If you just need a timer to generate periodic timeout I will suggest you use the GPTM timer - keeping one WD and one GPTM. If you must use two WD then it is very hard to prevent another one from firing while you are in the ISR if the two WD are not synchronous to each other. 

    To also give you a heads up, tomorrow is a US holiday and I will be out of office for a week. I will close the thread for now. If your problem is not resolved I will suggest you open a new thread so that our support team can assist you while I'm away. If you ask new questions or reply here, I'm afraid they will be missed by our support team.