Nile University
School of Engineering and Applied Sciences Embedded Real Time Systems
Lecture 1
Introduction to Embedded Systems
Dr. Noha Younis
[email protected]
Course Overview
Introduction to Embedded Real Time Systems (ERTS)
Embedded processors architectures
Embedded systems programming
Concurrency (Timers/ Counters)
Concurrency (Software and hardware interrupts)
Real-time principles and Real Time operating systems
Device Interfacing and Management (Analog signals and
ADC)
Device Interfacing and Management (Wireless
communications)
Device Interfacing and Management (Serial
Communications)
Power management
Profiling & Code Optimization (Performance and
memory)
2
ECEN435 Dr. Noha Younis
Course work
No project component
3 to 4 Quizzes
Midterm is in Week 3
Grade Distribution
# Category Weight(%)
1 Final 40
2 Midterm 20
3 Quizzes 15
4 Assignments 5
5 Lecture Attendance (A) & 5(A) + 5(P) = 10
Participation (P)
6 Tutorial Attendance 2.5 (A) + 2.5 (P) = 5
&Participation
7 Lab Attendance &Participation 2.5 (A) + 2.5 (P) = 5
3
ECEN435 Dr. Noha Younis
Assignments will be submitted using the Moodle ONLY
before deadline (no emails, and no late homework will
not be accepted).
Quizzes and Midterms date will be announced.
No make-up tests will be allowed.
Attendance and participation is very important, and
maximum allowable delay is 5 minutes.
You must attend the tutorials and labs to apply the
concepts yourself.
4
ECEN435 Dr. Noha Younis
Lecture 1
Introduction to Embedded Systems
What is the Embedded system (ES)?
Combination of Hardware and software to perform a specific task
Application specific Computer System (CS)
Direct interaction with environment
Analogous hardware for sensors and actors
5
ECEN435 Dr. Noha Younis
Examples of Embedded Systems
Consumer electronics (Smartphones: Media players, Cameras, GPS
devices, and Communication tools)
Automotive systems (Airbag System, Infotainment systems, ex.,
IDRIVE in BMW, Tesla TSI in Tesla: Touchscreen, Navigation, voice
controller, streaming games)
Industrial automation (Robotics)
Medical devices (Pacemakers, ECG recorder, Diagnostic equipment)
Home automation (Smart thermostats, security systems)
Embedded Systems Everywhere!
6
ECEN435 Dr. Noha Younis
Key Components of Embedded systems:
Central Processing Unit (CPU): Executes instructions
Memory: Stores code and data (RAM, ROM, Flash)
Peripherals: Interfaces for input/output (timers, GPIO, ADC, UART,
USB, Ethernet, WILAN, etc.)
Bus Systems: Communication pathways between components (data bus,
address bus, control bus)
7
ECEN435 Dr. Noha Younis
ERTS Characteristics and design Challenges
Resource
Efficiency
Constraints
8
ECEN435 Dr. Noha Younis
ERTS Characteristics and design Challenges
1-Real Time: Must meet strict timing constraints for timely responses.
Hard real-time systems: Missing a deadline could lead to catastrophic
consequences (Air bag – Pacemakers, Insulin pump, Autonomous car)
Soft real-time systems: Missing a deadline is undesirable but not catastrophic
(Video streaming – Online gaming)
2-Resource constraints: Limited processing power, memory, and power
consumption.
3-Efficiency: Embedded systems must use their limited resources as efficiently as
possible. (Optimizing code to reduce memory usage and processing time)
4-Reliability and stability: Often deployed in critical applications where failures
are unacceptable (Medical devices or automotive systems)
5- Low Power: Designed for energy efficiency, especially important in battery-
powered devices (Portable devices)
6- Multirate: Capable of handling tasks with different timing requirements
simultaneously.
7- Minimal User Interface: Operates with a simple or no user interface (Limited
user intervention).
8- Complex Algorithm: Executes complex computations and algorithms
(Image/signal processing, Data encryption, Deep Learning)
9- Low Cost: Designed to be cost-effective, especially in mass production.
10- Task Specific: Optimized for specific functions rather than general-purpose use.
9
ECEN435 Dr. Noha Younis
Types of Embedded Processors
Microprocessors: General-purpose CPUs used in more
complex systems (e.g., ARM Cortex-A and R, Intel, AMD,
RISC-V)
Microcontrollers: Integrate CPU, memory, and peripherals
in a single chip (e.g., ARM cortex-M, AVR, PIC, RISC-V)
Digital Signal Processors (DSPs): Specialized for signal
processing tasks (e.g., TI C2000)
Application-Specific Integrated Circuits (ASICs):
Custom-designed for specific applications
Field-Programmable Gate Arrays (FPGAs):
Reconfigurable hardware for custom tasks
10
ECEN435 Dr. Noha Younis
Microcontroller vs. Microprocessor
Microprocessor- Based ES
Microcontroller - Based ES
Microcontroller - Based ES
11
ECEN435 Dr. Noha Younis
Microcontroller vs. microprocessor
12
ECEN435 Dr. Noha Younis
MCU Selection Guide for Specific ES
Selection Example Use
Aim MCU Example MCU Specifications
Criteria Case
Ultra-low
Powered Texas instrumentconsumption,
Power To maximize battery
wearable MCU : MSP430 suitable for long-
Consumption life
health monitor series duration battery-
powered applications
High processing
Real-time
High processing speed ARM Cortex-M4 speeds (up to 180
Processing audio/video
to handle real-time MCUs (e.g., MHz), efficient
Speed processing
audio/video data STM32F4 series) processing
device
capabilities
Sufficient RAM to Up to 512 KB of
Storage Data logging temporarily store large SRAM, sufficient for
STM32F7 series
Memory device amounts of data before data-intensive
processing or transfer applications
Large number of I/O
Industrial Microchip PIC18F Up to 70 I/O pins,
pins for multiple
I/O Pins automation series (e.g., suitable for extensive
sensor/actuator
system PIC18F87K22) peripheral interfacing
interfaces
Example: A Smart Weather Monitoring Station is designed to collect and transmit environmental
data (temperature, atmospheric pressure, humidity, etc.). The system requirements include:
Operating at 100 MHz.
Total Power Budget: 500 mW.
Components Power Consumption:
1. Sensors: 100 mW
2. Communication Module: 200 mW
3. Display: 150 mW
Three microcontrollers are considered for this embedded system:
1. Microcontroller A:
Active Power Consumption: 16.5 mW
Sleep Power Consumption: 0.9 mW
Performance: 110 MHz CPU, 512 KB Flash, 64 KB SRAM
13
ECEN435 Dr. Noha Younis
2. Microcontroller B:
Active Power Consumption: 10.2 mW
Sleep Power Consumption: 0.3 mW
Performance: 48 MHz CPU, 128 KB Flash, 20 KB SRAM
3. Microcontroller C:
Active Power Consumption: 9.9 mW
Sleep Power Consumption: 1.4 mW
Performance: 150 MHz CPU, 512 KB Flash, 384 KB SRAM
Note: Power consumptions are estimated at a consistent voltage and frequency equivalent to 48
MHz for MCU B and 100 MHz for MCUs A and C. The MCU should operate actively for 30%
of the time and idle for 70% of the time
Solution: Available Power Consumption for Microcontroller:
Available Power = Total Power Budget - Power consumed by other components
Available Power = 500 mW - (100 mW + 200 mW + 150 mW) = 50 mW
Calculating Power Consumption for MCU A and C:
Estimated Power for MCU A: (16.5 mW * 0.3) + (0.9 mW * 0.7) = 5.58 mW
Estimated Power for MCU C: (9.9 mW * 0.3) + (1.4 mW * 0.7) = 3.95 mW
Selection Criteria:
Microcontroller B is excluded because its maximum operating frequency (48 MHz) does
not meet the required 100 MHz.
Both MCU A and MCU C consume power within the available budget (< 50 mW).
However, MCU C is preferred for the following reasons:
1. It offers 384 KB SRAM, suitable for processing data from multiple sensors.
2. It consumes less power than MCU A, allowing for potential addition of extra
components if needed.
14
ECEN435 Dr. Noha Younis
Embedded processors architectures
Case study: ATmega32
Reference: ATMEGA32 datasheet
Applications of ATmega32:
Consumer Electronics: Remote controls, thermostats, and other household devices.
Automotive Systems: Small control units for different functions.
Industrial Automation: Control systems, and robotics.
Home Automation: Smart home devices and IoT applications.
Educational Projects: Popular in academic settings for teaching microcontroller
programming and electronics.
15
ECEN435 Dr. Noha Younis
Key Features of ATmega32:
1. Architecture:
8-bit AVR “Modified Harvard”
Reduced Instruction Set Computer (RISC) Architecture.
8-bit 32 General Purpose Working Registers.
Up to 16 MIPS Throughput at 16 MHz
2. Memory Architecture:
32 KB of In-System Programmable Flash: (non-volatile) Used for
storing the compiled program code (firmware). It has an endurance of
at least 10,000 write/erase cycles.
2 KB of SRAM: (volatile) used for storing variables, stacks, and
other temporary data required by the program during execution.
1 KB of EEPROM:( non-volatile: used for storing data that needs to
be retained even when the microcontroller is powered off:
(configuration, Calibration) It has an endurance of at least 10,000
write/erase cycles
3. Clock Speed:
Operates at a maximum frequency of 16 MHz, providing sufficient speed for
many embedded applications.
Internal RC Oscillator: The ATmega32 has an internal RC (resistor-capacitor)
oscillator that provides a default clock frequency of approximately 1 MHz.
External Crystal or Resonator: The ATmega32 can be configured to use an
external crystal or ceramic resonator for more accurate and stable clock
frequencies. Typical crystal frequencies used with the ATmega32 range from 1
MHz to 16 MHz, with 8 MHz being a common choice.
4. I/O Ports:
32 General Purpose I/O Lines: These can be configured as input or output,
providing flexibility for various applications.
16
ECEN435 Dr. Noha Younis
5. Peripherals:
Timers/Counters: Three timers (one 8-bit and two 16-bit) for time-related
operations.
ADC (Analog to Digital Converter): 8-channel 10-bit ADC for analog signal
conversion.
PWM (Pulse Width Modulation): For motor control and other applications.
USART (Universal Synchronous and Asynchronous Serial Receiver and
Transmitter): For serial communication.
SPI (Serial Peripheral Interface): For high-speed synchronous data transfer.
TWI (Two-Wire Interface): Also known as I2C, for communication with other
devices.
Watchdog Timer: Helps in recovering from unexpected crashes.
6. Special Function Registers: controlling I/O pins, configuring timers, managing
interrupts, UARTs and ADCs.
7. Power Management: Multiple power-saving modes to reduce power consumption in
battery-operated applications:( Idle, ADC Noise Reduction, Power-Down, Power-Save,
Standby, Extended Standby)
17
ECEN435 Dr. Noha Younis