Microcontroller and Embeddes System - ARM Program Optimization 5
Microcontroller and Embeddes System - ARM Program Optimization 5
MICROCONTROLLER AND
EMBEDDED SYSTEMS
MODULE 4
Syllabus- Module 4 2
o Memory
o History of embedded systems
o Sensors,
o Classification of Embedded systems
o Actuators
o Major applications areas of embedded
o LED, 7 segment LED display
systems
o Stepper motor, Keyboard, Push button switch,
o Purpose of embedded systems. o Communication Interface (onboard and external types),
o Embedded firmware,
2. Write the program in Assembly language using the instructions supported by your
application’s target processor/controller.
Embedded Firmware 4
➢ The instruction set for each family of processor/controller is different and the
program written in either of the methods should be converted into a processor
understandable machine code before loading it into the program memory.
➢ The process of converting the program written in either a high level language or
processor/controller specific Assembly code to machine readable binary code is
called ‘HEX File Creation’.
o If the program is written in Embedded C/C++ using an IDE, the cross compiler included
in the IDE converts it into corresponding processor/controller understandable ‘HEX File’.
o If you are following the Assembly language based programming technique, you can use
the utilities supplied by the processor/controller vendors to convert the source code into
‘HEX File’.
Embedded Firmware 5
➢ The second method deals with splitting the functions to be executed into tasks
and running these tasks using a scheduler which is part of a General Purpose or
Real Time Embedded Operating System (GPOS/RTOS).
Other System Components 6
➢ The reset circuit is essential to ensure that the device is not operating at a voltage level
where the device is not guaranteed to operate, during system power ON.
➢ The reset signal brings the internal registers and the different hardware systems of the
processor/controller to a known state and starts the firmware execution from the reset
vector
o Normally from vector address 0x0000 for conventional processors/controllers.
➢ Since the processor operation is synchronized to a clock signal, the reset pulse should be
wide enough to give time for the clock oscillator to stabilize before the internal reset state
starts.
Reset Circuit 8
Reset Circuit 9
➢ It is essential for battery powered devices since there are greater chances
for the battery voltage to drop below the required threshold.
o The processor behaviour may not be predictable if the supply voltage falls below
the recommended operating voltage.
➢ The Zener diode DZ and transistor Q forms the heart of this circuit.
➢ The transistor stops conducting when the supply voltage falls below
the sum of VBE and VZ .
o Select the Zener diode with required voltage for setting the low threshold
value for VCC.
o The values of R1, R2, and R3 can be selected based on the electrical
characteristics of the transistor in use.
➢ Certain devices may not contain a built-in oscillator unit and require the
clock pulses to be generated and supplied externally.
➢ The speed of operation of a processor is primarily dependent on the clock
frequency.
o However we cannot increase the clock frequency blindly for increasing the speed
of execution.
➢ The logical circuits lying inside the processor always have an upper
threshold value for the maximum clock at which the system can run,
beyond which the system becomes unstable and non functional.
Oscillator Unit 16
➢ Real-Time Clock (RTC) is a system component responsible for keeping track of time.
➢ RTC holds information like current time (In hours, minutes and seconds) in 12 hour/24
hour format, date, month, year, day of the week, etc. and supplies timing reference to the
system.
➢ RTCs are available in the form of Integrated Circuits from different semiconductor
manufacturers like Maxim/Dallas, ST Microelectronics etc.
➢ The RTC chip contains a microchip for holding the time and date related information and
backup battery cell for functioning in the absence of power, in a single IC package.
➢ The RTC chip is interfaced to the processor or controller of the embedded system.
Real-Time Clock (RTC) 18
➢ For Operating System based embedded devices, a timing reference is essential for
synchronising the operations of the OS kernel.
➢ The RTC can interrupt the OS kernel by asserting the interrupt line of the
processor/controller to which the RTC interrupt line is connected.
o The OS kernel identifies the interrupt in terms of the Interrupt Request (IRQ) number generated
by an interrupt controller.
o One IRQ can be assigned to the RTC interrupt and the kernel can perform necessary operations
like system date time updation, managing software timers, etc. when an RTC timer tick interrupt
occurs.
➢ The RTC can be configured to interrupt the processor at predefined intervals or to interrupt
the processor when the RTC register reaches a specified value (used as alarm interrupt).
Watchdog Timer 19
➢ 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 (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 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.
Watchdog Timer 22
➢ 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.
o Can be a built in watchdog timer, or an external watchdog timer IC circuit.
➢ The external watchdog timer uses hardware logic for enabling/disabling, resetting the
watchdog count, etc. instead of the firmware based 'writing' to the status and watchdog timer
register.
➢ In modern systems running on embedded OS, the watchdog can be implemented in such a way
that when a watchdog timeout occurs, an interrupt is generated instead of resetting the
processor.
o The interrupt handler for this handles the situation in an appropriate fashion.
PCB and Passive Components 23
➢ After finalising the components and the inter-connection among them, a schematic design is
created and according to the schematic, the PCB is fabricated.
o PCB acts as a platform for mounting all the necessary components as per the design requirement.
➢ Apart from the subsystems mentioned already, passive electronic components like resistor,
capacitor, diodes, etc. are also found on the board.
o They are the co-workers of various chips contained in the embedded hardware.
o They are very essential for the proper functioning of your embedded system.
o For example for providing a regulated ripple-free supply voltage to the system, a regulator IC and
spike suppressor filter capacitors are very essential.