How to use watch in opentcp.?

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

How to use watch in opentcp.?

4,247 次查看
IamX
Contributor I
How to use watch in opentcp.?
I have some problem.
Board is still not running.
 
I will use watchdog for solve this problem.
 
How to use it.?
 
Thank you.
标签 (1)
0 项奖励
8 回复数

942 次查看
IamX
Contributor I
How to modify Kick_WD() function.?
I never use it.
Thank you for reply.
0 项奖励

942 次查看
pittbull
Contributor III
Hi,
Open 'system.c', locate 'kick_WD' and then change its body...

/* Watchdog refresh */
void kick_WD (void)
{
// Do something here that prevents watchdog from biting
}
0 项奖励

942 次查看
IamX
Contributor I
Thank you pittbull
How to initial it before use kick_wd();
Or
Opentcp code include it.
I can't find initial code for use watchdog.
If you have sample code for use it.
Please suggest me
 
Thank you
Mr.X
0 项奖励

942 次查看
pittbull
Contributor III
IamX wrote:
I can't find initial code for use watchdog.

Hi,
I don't think that OpenTCP initializes the WD. It's outside the scope of a TCP stack :smileywink:
You should initialize the WD at system startup.
And how this can be done depends on the MCU you are using.
Please see the MCU programmer manual how WD can be activated...
0 项奖励

942 次查看
IamX
Contributor I
Thank you.
You say : It's outside the scope of a TCP stack .
That mean
Opentcp shold be not use watchdog.
If I wrong understand.Please suggest again.

I little english language.

Thank you.
0 项奖励

942 次查看
pittbull
Contributor III
IamX wrote:
You say : It's outside the scope of a TCP stack.That meanOpentcp shold be not use watchdog.

No, I mean OpenTCP should not initialize it because it affects the whole system, not only TCP.
Indeed, OpenTCP must satisfy the WD. Imagine the checksum calculation over a huge packet which eats many CPU cycles...
0 项奖励

942 次查看
Goz
Contributor I
Sorry but you are wrong pitbull, you can run the OpenTCP stack with a watchdog on as I have done so without any problems. You just have to make sure that you kick the watchdog regularly.
 
To activate the watchdog apply the following code (btw this is in C)
 
COPCTL = 0x07;
 
void kick_WD (void)    <------- this routine is in system.c
{
     ARMCOP = 0x55;
     ARMCOP = 0xAA;
}
 
All you have to do is make sure that you call kick_WD regularly to stop it from resetting the device.
 
Remember if something goes wrong in the code and you need to debug, you have to remove the COPCTL initialisation line.
0 项奖励

942 次查看
pittbull
Contributor III
Hello,
OpenTCP has a function in 'system.c' that is called 'kick_WD'
When OpenTCP performs lengthy tasks it calls this function.
You can modify 'kick_WD' to satisfy your needs...

Hope that helps,
-> pittbull
0 项奖励