cannot disable watchdog in PT60

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

cannot disable watchdog in PT60

跳至解决方案
1,498 次查看
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

标签 (1)
0 项奖励
回复
1 解答
1,260 次查看
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 项奖励
回复
4 回复数
1,260 次查看
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 项奖励
回复
1,260 次查看
IlConte
Contributor IV

Unfortunately the code is correct !!

pastedImage_0.png

0 项奖励
回复
1,261 次查看
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 项奖励
回复
1,260 次查看
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 项奖励
回复