Chapter 4 Real Time and
Chapter 4 Real Time and
JIGJIGA University
Real Time and Embedded Systems
Hand-out of Chapter 4
------------------------------------------------------------------
Embedded Firmware
Oscillator Unit
A microprocessor/microcontroller is a digital device made up of
digital combinational and sequential circuits.
The instruction execution of a microprocessor/controller occurs in
sync with a clock signal.
It is analogous to the heartbeat of a living being which synchronizes
the execution of life.
For a living being, the heart is responsible for the generation of the
beat whereas the oscillator unit of the embedded system is responsible
for generating the precise clock for the processor.
Certain processors/controllers integrate a built-in oscillator unit and
simply require an external ceramic resonator/quartz crystal for
producing the necessary clock signals.
Quartz crystals and ceramic resonators are equivalent in operation,
however they possess physical difference.
Watchdog Timer
In desktop Windows systems, if we feel our application is behaving in
an abnormal way or if the system hangs up, we have the 'Ctrl + Alt +
Del to come out of the situation.
What if it happens to our embedded system? Do we really have a
'Ctrl + Alt + Del to take control of the situation? Of course not
But we have a watchdog to monitor the firmware execution and
reset the system processor/microcontroller when the program
execution hangs up.
A watchdog timer, or simply a watchdog, is a hardware timer for
monitoring the firmware execution.
Depending on the internal implementation, the watchdog timer in-
crements or decrements a free running counter with each clock pulse
and generates a reset signal to reset the processor if the count reaches
zero for a down counting watchdog, or the highest count value for an
up counting watchdog.
If the watchdog counter is in the enabled state, the firmware can
write a zero (for up counting watchdog implementation) to it before
starting the execution of a piece of code (subroutine or portion of code
which is susceptible to execution hang up) and the watchdog will start
counting.
If the firmware execution doesn't complete due to malfunctioning,
within the time required by the watchdog to reach the maximum
count, the counter will generate a reset pulse and this will reset the
processor (if it is connected to the reset line of the processor).
If the firmware execution completes before the expiration of the
watchdog timer you can reset the count by writing a 0 (for an up
counting watchdog ' timer) to the watchdog timer register.
Most of the processors implement watchdog as a built-in component
and provides status register to control the watchdog timer (like
enabling and disabling watchdog functioning) and watchdog timer
register for writing the count value.