Hi,
I'm using 16/32-bit ARM microcontroller. I want to reset the controller after sometime say 10 sec using watchdog timer. The datasheet consists of the watchdog timer register.
Instead of the register name, the demo code uses the address.
eg:
sync();
*(unsigned int volatile *)(0xfff8101c)=0x83;
I don't know ARM.
what does a "watchdog register" do? Do you for example set it to 10 (or whatever ) and it counts down, so you have to constantly reset the value or "something happens" when it hits 0?
Or is it a count-up timer, always increasing?
Does the tool have an elapsed time library already? Most MC do.
what is 83x? (I know its 131 in hex. I mean, what does it mean here?)
Instead of the register name, the demo code uses the address.
That doesn't make any difference. It hopefully behaves in the expected way. Do not omit the volatile qualifier.
A watchdog register triggers an interrupt event conventionally when it reaches zero.
If you're having trouble deciphering your datasheet, you should link it here so that we can take a look at it.
Roughly, there will be a prescaler quotient which you will need to adjust along with the initial value of the timer register; the prescaler converts the clock frequency to some slower ((CLK/y)Hz) signal for some positive integer y -- the prescaled clock signal is what the timer counts down upon.
You need to set the prescaling quotient accordingly, and since presumably the counter width is 32-bits you MAY be able to get 10 seconds in.
If not, you will need to handle the delay yourself -- increment a variable in firmware and do something after it reaches a certain value.