to reset my µC I use - starving the watchdog in an endless loop or - setting WDGCR to 0xFF followed by 0x80 (clearing T6). You can also use the HALT instruction with WDG is activated (but: see chapter 11.1.4.1). WoRo
I need to distinguish between wdg reset and my own reset when micro starts up. illegal opcode execution does not set wgd reset flag in SICSR. What do u mean under ''chapter 11.1.4.1'' ? What kind of an is it?
Sorry I forgot about to say: I refere to the main document - the datasheet.
I wouldn't take an illegal opcode to restart because you never can be sure they will abide this instruction. They might change it at any time without notice. Alternation: Fix a memory cell e.g. with 0xA5 before triggering the watchdog and read this before initialising your memory. WoRo
On 28-02-2006 at 09:39, Anonymous wrote: Sorry I forgot about to say: I refere to the main document - the datasheet. I am still not getting you. What type of datasheet do u mean?
Quote:
I wouldn't take an illegal opcode to restart because you never can be sure they will abide this instruction. They might change it at any time without notice. Alternation: Fix a memory cell e.g. with 0xA5 before triggering the watchdog and read this before initialising your memory. WoRo Tnx for advice, but my micro st7mc2 has flash memory only, and it is a bit complex to store some byte there.
sorry I supposed a ST7Lite2x but with your micro you must read: But: see chapter 10.1.4 Using Halt Mode with the WDG. What I mean with the memory cell is that you can determine any unused RAM cell, set it to a special value e.g. 0xA5 and then force a watchdog reset. Immediately after a reset you should fetch the value and reset the RAM memory to a base value e.g. 0x00. Thus checking the fetched value you can recognise whether you have passed a tagged (0xA5) watchdog reset or not (0x00). WoRo
Now, I understand your idea. It is pretty good. But are u sure that reset doesn't disturb ram memory? As far as i know the content of ram memory is undefined after reset. Is anywhere notice about memory state after reset? I would be very appreciated if u give me a link.
Posted on March 01, 2006 at 03:46Be careful if you do that (use a special ram location as the flag for the type of reset) in C, as the standard startup code will clear your flag before you have a chance to test it; you will have to use a special version (customized by yourself) of the startup code. Regards, Luca