Hi All, I am working on a Renesas M16C Micro and I am having problems debugging my code.... I get a watchdog at a certain point in my code. I am unable to figure out where the watchdog occurs because the program counter points to special function register 0x000343. Is it possible that the program counter can ever point to a special function register? I thought it should always point to an instruction. Thanks

PC pointing to SFR after Watchdog
Started by ●August 14, 2006
Reply by ●August 15, 20062006-08-15
hendrik <hendrik.botha@gmail.com> wrote:> I get a watchdog at a certain point in my code. I am unable to figure > out where the watchdog occursAnd why would you want to know that? A genuine watchdog bite, as opposed than one you triggered on purpose, will occur at a moment that is, for all practical purposes, perfectly random. When or where it happens has nothing to do with the actual problem that caused it.> Is it possible that the program counter can ever point to a special > function register?Possibly --- I don't know that architecture. But since it's apparently von-Neumann enough that an SFR address can even _be_ in the PC register, then well, if you jump to an SFR's address, that's what it'll point to. But odds are you're expressly forbidden from doing that, by some statement in the datasheets. Not to mention that common sense already forbids it.> I thought it should always point to an instruction.It should. But are your sure your program isn't doing what it shouldn't, like jump to never-never-land and happen to land in SFR-space? -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
Reply by ●August 15, 20062006-08-15
hendrik <hendrik.botha@gmail.com> wrote:> I get a watchdog at a certain point in my code. I am unable to figure > out where the watchdog occursAnd why would you want to know that? A genuine watchdog bite, as opposed to one you triggered on purpose, will occur at a moment that is, for all practical purposes, perfectly random. When or where it happens has nothing to do with the actual problem that caused it.> Is it possible that the program counter can ever point to a special > function register?Possibly --- I don't know that architecture. But since it's apparently von-Neumann enough that an SFR address can even _be_ in the PC register, then well, if you jump to an SFR's address, that's what it'll point to. But odds are you're expressly forbidden from doing that, by some statement in the datasheets. Not to mention that common sense already forbids it.> I thought it should always point to an instruction.It should. But are your sure your program isn't doing what it shouldn't, like jump to never-never-land and happen to land in SFR-space? -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
Reply by ●August 17, 20062006-08-17
Hendrik, Do you use a C compiler or do you program in assembly ? Before being able to provide a uesful reply you should describe what you are doing. This also includes what the M16C Watchdog is set up to do. If it is set to trigger an interrupt you should carefully check the entries of the interrupt vector table. Other than that you am also check whether or not all registers in use are properly saved in the event of an interrupt. I guess some reading of the M16C user Manual, section interrupts will reveal the solution. grtnx /jan "hendrik" <hendrik.botha@gmail.com> schrieb im Newsbeitrag news:1155535878.539119.285970@p79g2000cwp.googlegroups.com...> Hi All, > > I am working on a Renesas M16C Micro and I am having problems debugging > my code.... > > I get a watchdog at a certain point in my code. I am unable to figure > out where the watchdog occurs because the program counter points to > special function register 0x000343. > > Is it possible that the program counter can ever point to a special > function register? I thought it should always point to an instruction. > > Thanks >
Reply by ●August 17, 20062006-08-17
Jan Homuth schrieb:> Hendrik, > > Do you use a C compiler or do you program in assembly ? > > Before being able to provide a uesful reply you should describe what you are > doing. > > This also includes what the M16C Watchdog is set up to do. > If it is set to trigger an interrupt you should carefully check the entries > of the interrupt vector table. > > Other than that you am also check whether or not all registers in use are > properly saved in the event of an interrupt. > > I guess some reading of the M16C user Manual, section interrupts will reveal > the solution. > > grtnx > /jan > > > "hendrik" <hendrik.botha@gmail.com> schrieb im Newsbeitrag > news:1155535878.539119.285970@p79g2000cwp.googlegroups.com... >> Hi All, >> >> I am working on a Renesas M16C Micro and I am having problems debugging >> my code.... >> >> I get a watchdog at a certain point in my code. I am unable to figure >> out where the watchdog occurs because the program counter points to >> special function register 0x000343. >> >> Is it possible that the program counter can ever point to a special >> function register? I thought it should always point to an instruction. >> >> Thanks >> > >Hi Hendrik, take a look into chapter 24 (Precautions) of the hardware manual. I got unexpected interrupts due to the problem described in part 24.7.6 (Rewrite the Interrupt Control Register), which crashed my program -- not too often, to make it more interesting. Jan is right: you ought to describe what you are doing and which tools you use (ice?) so you can get a more specific answer. -- Dirk
