cancel
Showing results for 
Search instead for 
Did you mean: 

WDT reset recognition in ST7FMC

jermakov
Associate II
Posted on September 20, 2007 at 07:09

WDT reset recognition in ST7FMC

4 REPLIES 4
jermakov
Associate II
Posted on September 11, 2007 at 12:40

Hello,

I am projecting e-bike controlling system on the ST7FMC. The SW application is working good, but it is not really protected from the noise and disturbance going from the motor power stage.

So I have activated WDT with idea to provide application restoring on any disturbance which causes SW gets crashed or stopped.

The current problem for me is to separate external reset event from the one generated by WDT.

I have tryied this codes:

void main(void)

{

ClrBit(SICSR,PAGE);

if (!ValBit(SICSR,WDGRF))

{

//WDT reset observed

//reset bit to prepare for next reset

ClrBit(SICSR,WDGRF);

}

else

{

//external reset oserved

}

...

But these codes give me the same result every time undependend of the reset source - exactly like reset is always external.

What is wrong in my codes?

Thank you,

Alexander.

luca239955_st
Associate III
Posted on September 12, 2007 at 07:42

the general idea for making the difference between an poweron reset and a WDT reset is that you take a few bytes of RAM and, at the beginning the application write a pattern in these locations that could hardly be there by chance.

When you get a reset you check those bytes: if the pattern is there, it's a WDT reset, otherwise it's a PowerOn reset.

Hope it helps.

Luca

jermakov
Associate II
Posted on September 12, 2007 at 11:37

Hello Luca,

Thanks for the answer and nice idea.

Sure, it could be used in my application(and I will do this, if no success with WDGRF bit), but it has the certain disadvantage, that it doesn't work work for external reset occured while MCU is powered, at this case the pattern left untouched. But you are right, this is a good method to separate WDT and POWERON resets.

Do you know something about big WDGRF, it is working or not?

Regards,

Alexander.

jermakov
Associate II
Posted on September 20, 2007 at 07:09

Hi Luka,

Finally the issue has been solved. I have not found any ideas in the ST7FMC datasheet, but when occasionally I opened datasheet of ST72324, I was suprized found this caution in the chapter 6.4.5:

''CAUTION: When the LVD is not activated with the

associated option byte, the WDGRF flag can not

be used in the application.''

There such coution is missed in the datasheet of ST7FMC, which I am using in my application for e-bike.

So once I activated the LVD bit in the option byte, the issue has been solved.

What can I say now? RTFM, especially of the related and similar product. Sometimes solution is nearby at the next door.

Regards,

Alexander.