1 | P a g e
Embedded Systems X
TABLE OF CONTENTS
Table of Contents 1
Table of Figures 6
Table of Tables 8
Table of Programs 9
1 Fundamental Concepts 10
1.1 Embedded Systems 10
1.1.1 Component of an Embedded System: 10
1.1.2 Embedded System Considerations 10
1.1.3 Hardware 11
1.1.4 Real-Time 12
1.1.5 Embedded System Characteristics 13
1.2 Introduction to computers 13
1.3 I/O Ports 16
1.3.1 TM4C123 I/O ports 16
1.3.2 Type of I/O 16
1.4 CPU Registers 17
1.4.1 An ISA must address the following things 17
1.4.2 Popular ISA 17
1.4.3 Registers in ARM ISA 18
1.5 Assembly Language 19
1.5.1 Assembly Language 19
1.5.2 Instruction Format 22
1.5.3 Addressing Modes and Operands 22
1.6 Address Space 28
1.7 Software Development Process 29
1.8 Using Keil 31
2 | P a g e
6.2 Debugging Theory 64
3 | P a g e
6.2.1 Intrusiveness 64
6.2.2 Black-box and White-box Testing 66
6.3 SysTick Timer 67
6.3.1 Working of the SysTick Timer 67
6.3.2 SysTick Initialization 68
6.3.3 Measuring time 70
6.4 Arrays 71
6.5 Strings 71
6.6 Functional Debugging 71
6.6.1 Testing and Debugging 71
6.6.2 Functional Debugging 72
6.6.3 Single Stepping 72
6.6.4 Print statement 73
6.6.5 Debugging dump 74
6.6.6 Safety Critical Situations 75
6.6.7 Debugging using Logic Analyzer 76
6.6.8 Debugging using Instrumentation 76
7 Finite State Machine 79
7.1 Introduction 79
7.2 Phase-Lock-Loop 79
7.2.1 Phase-Lock-Loop PLL 79
7.2.2 Crystal Timing 80
7.2.3 Controlling the clock source 83
7.2.4 Software work 84
7.2.5 Battery powered system 85
7.2.6 Low power design 85
7.3 Accurate Time Delays Using SysTick 86
8.4 Conversion 128
8.4.1 Conversion 128
8.4.2 Output decimal number 131
8.5 Distributed System 133
8.5.1 Topology 133
5 | P a g e
8.5.2 Distributed Systems 134
8.5.3 Chat tool program 135
8.5.4 Interfacing the Nokia 5110 using a Synchronous Serial Port 137
9 Interrupts 143
9.1 Introduction 143
9.2 Interrupt concepts 143 6 | P a g e
TABLE OF FIGURES
Figure 1: The basic components of a von Neumann computer include processor, memory
and I/O. 14
Figure 2: Harvard architecture of an ARM® Cortex-M-based microcontroller. 14
Figure 3: Architecture of TM4C123 microcontroller. 16
Figure 4: Registers on the ARM® Cortex-M processor. 18
Figure 5: The program status register of the ARM® Cortex-M processor. 19
Figure 6: An example of immediate addressing mode, data is in the instruction. 23
Figure 7: An example of indexed addressing mode, data is in memory. 24
Figure 8: An example of indexed addressing mode with offset, data is in memory. 25
Figure 9: Indexed addressing using R1 as a register pointer to access memory. Data is
moved into R0. Code space is where we place programs and data space is where we place
variables. 26
Figure 30: Instantaneous current measured on a battery powered system. 86
Figure 31: A structure collects elements of different sizes and/or types into one object. 88
Figure 32: System's schematic which can be abstracted as an FSM 89
Figure 33: FSM Graph of bit 1 recognizing System 91
Figure 34: The output in a Moore depends just on the state. In a Mealy the output depends
on state and input 93
Figure 35: Traffic light interface with two sensors and 6 lights 97
Figure 36: Graphical form of a Moore FSM that implements a traffic light 98
Figure 37: A vending machine interfaced to a microcontroller 102
Figure 38: This Moore FSM implements a vending machine 103
Figure 39: Synchronization Mechanisms 111
Figure 40: The output device sets a flag when it has finished outputting the last data 112
Figure 41: The software must wait for the input device to be ready (I/O bound input
interface) 114
Figure 42: The software must wait for the output device to finish the previous operation
(I/O bound) 115
Figure 43: A FIFO queue can be used to pass data from a producer to a consumer. At any
given time there can be a variable number of elements stored in the FIFO. The order in
which data are removed is the same as the order the data are entered 115
Figure 44: UART usages on the LaunchPad 118
Figure 45: Basic UART operations 118
Figure 46 A serial data frame with 8-bit data, 1 start bit, 1 stop bit, and no parity bit 119
Figure 47: Hardware interface implementing an asynchronous RS232 channel. The
TM4C123 has eight UART ports 121
Figure 48: Flowcharts of InChar and OutChar using busy-wait synchronization 126
Figure 49: Successive refinement method for the iterative solution 132
Figure 50: A simple ring network with three nodes, linked using the serial ports 133
Figure 51: Distributed processing places input, output and processing at multiple locations
connected together with a network 134
Figure 52: Distributed using two LaunchPads connected together by the UARTs 136
Program 10: Use of SysTick to delay for a specified amount of time (C10_SysTick_Wait).
87
Program 11: A function that accesses a structure. 89
Program 12: Data Structure Realization of a FSM of Bit 1 recognizing System 95
Program 13: FSM controller 96
Program 14: Linked data structure implementation of the traffic light controller 100
Program 15: Low-level input/output functions for the vending machine 104
Program 16: Vending machine controller 105
Program 17: Tracking robot controller 108
Program 18: Low level I/O functions for tracking robot 109
Program 19: Device driver functions that implement serial I/O (CC11_UART and
C11_Network): 127
Program 20: Unsigned ASCII string to decimal conversion 128
Program 21: Input an unsigned decimal number 129
Program 22: Print the voltage value to an output device (0≤n≤999) 130
Program 23: Unsigned decimal to ASCII string conversion 130
Program 24: Print unsigned 32-bit decimal number to an output device 131
Program 25: Iterative implementation of output decimal: 133
Program 26: High-level communication network (C11_Network) 137
Program 27: I/O port connections and the Nokia display: 140
Program 28: Some of the prototypes for LCD 141
10 | P a g e
1 FUNDAMENTAL CONCEPTS
1.1 EMBEDDED SYSTEMS
An embedded system is a microcomputer with mechanical, chemical, or electrical devices
attached to it, programmed for a specific dedicated purpose, and packaged up as a
complete system.
1.1.1 Component of an Embedded System:
•
ARM: A-series in Handheld devices
•
ARM computer:
•
A-series: in handheld devices
•
M-series: microcontrollers
•
R-series: Real-time
Inside of a computer:
•
Memory
•
I/O interface: connect components together, including hardware and software
1.1.2 Embedded System Considerations
Testing & Verifications
Profit: Market share + Cost