AnsweredAssumed Answered

cannot disable watchdog in PT60

Question asked by Stefano De Blasiis on Feb 3, 2014
Latest reply on Feb 3, 2014 by Stefano De Blasiis

Dear all,

I have a S08PT60 and at the start of code, I disable the watchdog timer, but, after 6,2 ms the cpu reset.

I think that there is a error in my startup code . . . . but i don't find it !!

This is the my simple code:

 

; Include derivative-specific definitions

            INCLUDE 'derivative.inc'

           

 

; export symbols

            XDEF _Startup, main

            ; we export both '_Startup' and 'main' as symbols. Either can

            ; be referenced in the linker .prm file or from C/C++ later on

           

           

           

            XREF __SEG_END_SSTACK   ; symbol defined by the linker for the end of the stack

 

 

; variable/data section

MY_ZEROPAGE: SECTION  SHORT         ; Insert here your data definition

 

; code section

MyCode:     SECTION

main:

_Startup:

            LDHX   #__SEG_END_SSTACK ; initialize the stack pointer

            TXS

           

            ldhx    #$C520

            sthx    WDOG_CNT                ; First part of the WDG unlock sequence

            ldhx    #$D928

            sthx    WDOG_CNT                ; Second part of the WDG unlock sequence

            lda     #$04

            sta     WDOG_TOVAL        ; 4 ms di time out

            lda     #$01

            sta     WDOG_CS2

            lda     #$00

            sta     WDOG_CS1          ; Disable watchdog

 

            lda     #%00100000

            sta     PORT_PTCOE

           

            lda     PORT_PTCD

            eor     #$20

            sta     PORT_PTCD       ; reset check

            eor     #$20

            sta     PORT_PTCD       ; reset check

            eor     #$20

            sta     PORT_PTCD       ; reset check

 

 

           

            CLI         ; enable interrupts

 

mainLoop:

            ; Insert your code here

            NOP

            BRA    mainLoop

 

 

I have uset the PC5 for verify if the cpu reset, and it is reset every 6,2 ms

 

Please help me !!

 

Thanks

 

Stefano

Outcomes