Chapter 2 - 095318 (1) II
Chapter 2 - 095318 (1) II
Memory Interface
It has Havard Architecture i.e. separate instruction and data buses for concurrent access to code and data memory. Supports Code
Memory, Data Memory (SRAM), and Peripherals Memory.
• Code Memory – Stores instructions (typically Flash).
• Data Memory – SRAM for variables and stack.
• Peripheral Memory – Mapped regions for peripherals like GPIO, ADC and Communication interfaces.
Ports
Ports is an ARM Cortex-M0+ microcontroller refer to the hardware interfaces used to interact with external devices. These ports allow the
processor to connect with sensors, actuators, communication devices and other peripherals.
1. General Purpose I/O Ports (GPIO) – It is configurable as either input or output. They allow the microcontroller to interface directly
with digital signals. Each GPIO pin can be individually controlled for input or output.
2. Analog I/O Ports
• Analog – to – Digital Converter (ADC) - Converts analog signals (e.g. from a temperature sensor) into digital values for processing.
Ports connected to ADC channels are used for analog inputs.
• Digital – to – Analog Converter (DAC) – Converts digital values to analog signals e.g. for controlling actuators or sound output.
3. Communication
Contex-M0+ microcontroller supports multiple communication protocols, making it highly versatile for embedded applications. These
communication peripherals allow data exchange wit sensors, actuators, other microcontrollers and external devices. The types of communication
in Cortex-M0+ are –
1. Serial Communication Protocols-
a. UART (Universal Asynchronous Receiver- Transmitter) – Use for serial communication. Transmit (TX) and Receive (RX) pins used
to send and receive data.
b. SPI (Serial Peripheral Interface) – High speed synchronous communication with multiple devices. Ports are –
o MOSI: Master Out, Slave In.
o MISO: Master In, Slave Out.
o SCK: Clock.
o SS/CS: Slave Select/Chip Select.
c. I2C (Inter-Integrated Circuit)/TWI (Two Wire Interface) – It is two-way synchronous protocol, uses only SDA (Serial Data) and SCL
(Serial Clock) line. It supports Multi-master, multi-slave. Use for EEPROMs, temperature sensors and real time clocks.
d. CAN (Controller Area Network) – Robust protocol designed for automotive and industrial systems. It is use for error detection and
fault tolerance.
2. Wireless Communication (via External Modules) – Although Contex-M0+ doesn’t have built-in wireless communication, it can interface
with external wireless modules:
a. Bluetooth: Using UART (e.g. HC-05 module).
b. Wi-Fi: Using SPI or UART (e.g. ESP8266, ESP32).
c. ZigBee/LoRa: Using UART or SPI for long-range communication.
3. Parallel Communication Protocols – Cortex-M0+ doesn’t include dedicated parallel communication peripherals, it can implement parallel
communication through its General Purpose Input/Output (GPIO) pins.
4. Ethernet Communication – Many Cortex-M0+ microcontrollers equipped with a MAC (Media Access Controller) or an external MAC/PHY
interface for Ethernet communication.
4. ATmega32 microcontroller Architecture
Interfacing Peripherals
• Interfacing handles how to connect with peripherals to
another Embedded System. It includes how to integrate and
communicate ES with each other. It also includes designing
software handlers that perform the communication through
the peripherals.
• In ATmega32 has 32 Programmable I/O lines – PortA,
PortB, PortC and PortD.
• Each Port consists three registers :
o Data Direction Register (DDRx)
o Output Register (PORTx)
o Input Register (PINx)
6. Programming in C to Interface peripherals, Interrupts, ISR and Timers Cont..
Timer Module
The timer of the AVR can be monitor Three events through State Register (TIMSK):
• Timer Overflow – means that the counter has counted up to its maximum value and is reset to zero in
the next timer clock cycle. The resolution of the timer determines the maximum value of that timer.
The timer overflow event causes the Timer Overflow Flag (TOVx) to be set in the Timer Interrupt Flag
Register (TIFR).
• Compare Match – In case where it is not sufficient to monitor a timer overflow. The compare match
interrupt can be used. The Output Compare Register (OCRx) can be loaded with a value [0.. MaxVal]
which the timer will be checked against every timer cycle. When the timer reaches the compare value,
the corresponding Output Compare Flag (OCFx) in the TIFR register is set. The Timer can be
configured to clear the count register to “0” on a compare match.
• Input capture – The AVR has an input pin to trigger the input capture event. A signal change at this
pin causes the timer value to be read and saved in the Input Capture Register (ICRx). At the same time
the ICFx in the TIFR will be set. This is useful to measure the width of external pulses.
THANK YOU VERY MUCH
chapter 2 Completed