ELEC3300 - 03-Embedded System Structure
ELEC3300 - 03-Embedded System Structure
ELEC3300 - 03-Embedded System Structure
Topic 3
Embedded System Structure
Prof. Tim Woo
Microcontroller Structure
A/D Port
Buffering and
Serial Port Direct Memory Access
CPU
(DMA)
External Memory Port
Memory,
Interfacing to Memory,
External Interrupt Port
Memory Timing
Interrupt and applications
External Timer Port Interfacing LCD
Organization Timer and
Counter Simple I/O Port
Motor Interfacing
In this course, STM32 is used as a driving vehicle for delivering the concepts.
To be covered In progress Done
• Processor with memory & I/O parts integrated on the same chip
• Program memory : ROM / EPROM / Flash
• Data memory: RAM / SRAM / Flash
Simple computation model (i.e. fetch-execute cycle) Any operating system support ?
CPU
Data memory
I/O port
Buses
* : STM32F103ZET6-STMicroelectronics-datasheet-7543760.pdf
Master
Master
Slave
Master
Data segment
Code segment
Base addresses
* : STM32F103ZET6-STMicroelectronics-datasheet-7543760.pdf
ELEC 3300 : Spring 17/18 Tim Woo 12
ARM Microcontroller: Memory Map
Base addresses
* : STM32F103ZET6-STMicroelectronics-datasheet-7543760.pdf
ELEC 3300 : Spring 17/18 Tim Woo 13
ARM Microcontroller: CRC Calculation Unit
Data decryption
Data encryption
# : STM32_Reference_Manual.pdf
Initialization implementation
Programming Language
ELEC 3300 : Spring 17/18 Tim Woo 15
Example: General-purpose I/O (GPIO)
#
We will use
these registers
# : STM32_Reference_Manual.pdf
Initialization
# : STM32_Reference_Manual.pdf
Pull-up resistor
Read
Yes
Next operation ?
No
End
Initialization
# : STM32_Reference_Manual.pdf
ELEC 3300 : Spring 17/18 Tim Woo 19
Example: Connect a switch to MCU board
• Implementation
– Write a routine for reading signal (Polling or Interrupt Driven)
– Either polling or interrupt driven I/O, we can implement following flow
charts.
Start Start
Initialization
(input port) Initialization
(input port)
Read Read
Yes Yes
Next operation ? Next operation ?
No No Note:
The data is stored in
Data Input Register.
End End
Initialization implementation
Programming Language
ELEC 3300 : Spring 17/18 Tim Woo 21
Example: Connect a LED to MCU board
• When configured as output, the value written
to the Output Data register (GPIOx_ODR) is
output on the I/O pin.
• It is possible to use the output driver in Push-
Pull mode or Open-Drain mode (only the N- Start
MOS is activated when outputting 0).
Initialization
#
(output port)
Write
Yes
Next operation ?
No
End
# : STM32_Reference_Manual.pdf
ELEC 3300 : Spring 17/18 Tim Woo 22
Example: Bi-directional I/O port
• How can we initialize an general purpose I/O pin as a bi-directional one?
• If yes, how does the flow chart look like?
Start
Input Output
Input / Output ?
Initialization Initialization
(Input) (Output)
Read Write
Yes Yes
Next Next
Read operation ? Write operation ?
No No
Yes Yes
Write operation? Read operation?
No No
MCU sends out
End Start Signal
DHT sends out
Response
Signal
P1.6
Assume all are 8-bit ports P1.5
P1.4
P1.3
P1.2
P1.1
P1.0
R0 R0 R1
P1 36H 36H 58H
Microcontroller Structure
A/D Port
Buffering and
Serial Port Direct Memory Access
CPU
(DMA)
External Memory Port
Memory,
Interfacing to Memory,
External Interrupt Port
Memory Timing
Interrupt and applications
External Timer Port Interfacing LCD
Organization Timer and
Counter Simple I/O Port
Motor Interfacing
In this course, STM32 is used as a driving vehicle for delivering the concepts.
To be covered In progress Done