cannot disable watchdog in PT60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

cannot disable watchdog in PT60

Jump to solution
635 Views
IlConte
Contributor IV

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

9427_9427.pngpastedImage_14.png

 

Please help me !!

 

Thanks

 

Stefano

Labels (1)
0 Kudos
1 Solution
397 Views
iansmusical
Contributor V

Hi Stefano,

Having now looked at the PT60 reference manual I'd agree with you that the code is correct and within the stipulated timings. Of course one hopes that the code in the reference manual is correct in itself ;-) The only difference I can see between your code and Freescales is the following line:

WDOG_TOVAL = 1000; // setting timeout value

You're setting 4 hex and they 1000 decimal?

Ian

View solution in original post

0 Kudos
4 Replies
397 Views
iansmusical
Contributor V

Ciao Stefano,

I haven't checked but it's possible that you are not using the correct watchdog timer unlock code(s), as I understand there can be different versions for each S08.

Ian

0 Kudos
397 Views
IlConte
Contributor IV

Unfortunately the code is correct !!

pastedImage_0.png

0 Kudos
398 Views
iansmusical
Contributor V

Hi Stefano,

Having now looked at the PT60 reference manual I'd agree with you that the code is correct and within the stipulated timings. Of course one hopes that the code in the reference manual is correct in itself ;-) The only difference I can see between your code and Freescales is the following line:

WDOG_TOVAL = 1000; // setting timeout value

You're setting 4 hex and they 1000 decimal?

Ian

0 Kudos
397 Views
IlConte
Contributor IV

Solved !!

The problem it isn't the value, but the dimension of WDOG_TOVAL, for takes effect it is necessary to write all register, and I wrote only the low of  WDOG_TOVAL

Thanks for making me understand the differences and bringing me on the right track.


Stefano

pastedImage_0.png

0 Kudos