EE2024/E Programming for Computer Interfaces Rajesh Panicker
[email protected] All slides are courtesy A/Prof CK Tham, ECE, NUS
Teaching Team •
•
•
•
Lecturer – Dr Raj Rajesh esh Pan Panick icker er Teaching Assistants Christophe topherr Moy (also (also a tutor tutor)) – Mr Chris – Mr Sha hahz hzor or Ah Ahma mad d Tutors – A/Pro A/Proff Bhara Bharadwaj dwaj Veera Veeravalli valli Ren – Dr Loke Yuan Re ~17 Graduate Assistants
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
What you will learn in this course Develop an ARM embedded system using assembly language and C •
Interface with devices such as sensors and actuators using industry-standard protocols •
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
Learning Outcomes – To be able to apply knowledge of microprocessor concepts to program a microprocessor or microcontroller using assembly language to perform an engineering task. – To be able to use different addressing modes to efficiently access data in CPU registers and memory. – To be able to configure CPU interrupts with different priorities to reflect the importance of different events. – To be able to apply knowledge of computer interfacing protocols such as I2C and UART, and to be able to implement these protocols using the C programming language, to interface a microprocessor to other devices such as sensors and actuators. – To be able to design and develop an embedded system application and qualitatively and quantitatively verify how well it meets design specifications and performs specified functions. EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
Lecture Plan Lecture 1: Introduction to Microprocessors & ARM Lecture 2: Microprocessor Concepts Lecture 3: ARM Cortex-M3 Overview Lecture 4: ARM Instruction Set & Assembly Language Lecture 5: Embedded System Development through C Programming (CMSIS) Lecture 6: Pin Connect Block Lecture 7: General Purpose Input/Output (GPIO) Briefing: EA Baseboard Lecture 8: Inter-Integrated Circuit (I2C) Protocol Lecture 9: Interrupt System & NVIC Lecture 10: Universal Asynchronous Receiver/Transmitter (UART) Protocol Revision • • • • •
• • • • • •
•
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
Assignments & Lab/Assessment Sessions •
2 Assignments – Assignment 1: ARM Assembly Language Assignment
(Weeks 4-6) – 15% – Assignment 2: ARM Embedded System Development (Weeks 7-13) – 35%
•
Lab Sessions – Session 1: Familiarization with Development Environment (Week 3) – Session 2: Assembly Language and C Programming (Week 4) – Session 3: Assignment 1 Assessment (Week 7) – Session 4: System Design and Baseboard Familiarization (Week 8) – Session 5: Interfacing to Sensors and Output Devices using GPIO and I 2C (Week 9) – Session 6: Interrupt Handling and Event Detection (Week 11) – Session 7: Interfacing to External System using UART (Week 12) – Session 8: Assignment 2 Assessment (Week 13)
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
Books Due to the state-of-the-art nature of this module, there is no single recommended textbook. •
•
Reference Books: – Joseph Yiu : The Definitive Guide to the ARM Cortex-M3, Newnes, 2010. (e-book available from NUS library) – Carl Hamacher, Zvonko Vranesic, Safwat Zaky, Naraig Manjikian: Computer Organization and Embedded Systems, 6th Edition, McGraw-Hill, 2012. ISBN 978-007-108900-5. – Sarah Harris, David Harris : Digital Design and Computer Architecture ARM Edition. ISBN: 978-0-12-800056-4 Note: These books are based on other versions of ARM Instruction Set. This module focuses on ARMv7-M instead. There are some differences. – NXP UM10360 LPC17xx User Manual – ARM®v7-M Architecture Reference Manual (ARM)
•
Other supporting documents (especially for assignment): – LPCXpresso: Getting started with NXP LPCXpresso – LPCXpresso Base Board Rev B User’s Guide
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
How To Approach This Module •
Try to be in sync with the material taught in the class – This module is like a jigsaw puzzle – Each piece, taken alone, might not make complete sense – You need to be familiar with the pieces and assemble them together mentally to form the complete picture!
Screencasts are meant for revision, not as a substitute for attending lectures. If you are not attending classes, you are missing something •
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
How To Approach This Module Lecture slides are meant to be a rough guideline, rather than comprehensive “notes” – You will need to use datasheets, manuals and internet •
resources as and when required – Not everything can be taught in the class : swimming, riding a bicycle, …, microcontroller programming (EE2024)
DO NOT send individual emails unless the matter is personal. Use the IVLE forum Consultation requests – Concepts : Lecturer or tutor – Labs : Teaching Assistants •
•
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
How To Approach This Module Come prepared for labs and follow the lab schedule Low-level programming involves dealing with a lot more uncertainties than conventional programming – Hardware board designs are usually not perfect – Since it involves exchanging data with external hardware •
•
(sensors etc), it is not easy to isolate errors and debug them – You need to deal with the “time” factor in your code -> what time does a particular code executes and for how long – Software toolchains (compiler, libraries, debugger etc.) for lower level programming are buggier than higher level compilers • •
Smaller user base Tools are tied to a specific hardware platform
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
1. Introduction to Microprocessors & ARM Rajesh Panicker
[email protected] All slides are courtesy A/Prof CK Tham, ECE, NUS
Lecture 1: Introduction to Microprocessors & ARM •
Objectives: – understand evolution of computing and position of ARM Cortex-M3 / NXP LPC1769 in the landscape, and key features of ARM Cortex-M3 / NXP LPC1769
•
Outline: – Short history of Computing and ARM – ARM Cortex-M3 Processor – NXP LPC1769 system-on-chip – Overview of this module, lecture plan, books
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
(Advanced RISC Machines) EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
•
Different ARM families
Main Strengths of ARM: High-performance Power-efficient Easy to integrate ARM core with peripherals to form system-on-chip Low cost • • •
•
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
ARM s-o-c in popular devices •
•
•
Apple A5 system-on-chip – CPU: Dual-core ARM Cortex-A9 – Instruction set: ARMv7-A – In iPhone 4S, iPad 2 Apple A6 system-on-chip – CPU: Dual-core Swift (~ARM Cortex-A15) – Instruction set: ARMv7s – In iPhone 5 – Note: iPhone 5s/6 uses A7/8 (64-bit ARMv8-A i.s.) Samsung Exynos Octa 5422/7420 s-o-c – CPU: 8-core ARM Cortex-A15/57 & A-7/53 – Instruction set: ARMv7/8-A – In Samsung Galaxy S5/6 EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
ARM Cortex-M3 – NXP LPC1769 • •
Operates at 120 MHz 100 pin packaging – Refer to UM10360 or data sheet for pinout details – Many of these pins have 4 functions – desired function is programmable (pin connect block, or PINSEL)
LPCXpresso board with IDE and Baseboard allows convenient access to LPC1769 functionalities – See Getting Started and •
Baseboard User’s Guide – Rich software library provided EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
LPC1769 SoC internals: functional view
AHB: Advanced High-Performance Bus APB: Advanced Peripheral Bus
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
ARM Cortex-M3 – NXP LPC1769 Cortex-M3 processor Incorporates a 3-stage pipeline and uses a Harvard architecture with separate local instruction and data buses as well as a third bus for peripherals • •
• •
512 KB of flash memory 64 KB on-chip SRAM includes: – 32 kB of SRAM on the CPU with local code/data bus for high-performance CPU access – two 16 KB SRAM blocks with separate access paths for higher throughput
these SRAM blocks may be used for Ethernet, USB, and DMA memory, as well as for general purpose instruction and data storage. •
•
Built-in Nested Vectored Interrupt Controller (NVIC)
Fast General Purpose Input Output (GPIO) ports Ethernet MAC a USB interface that can be configured as either Host, Device, or OTG (On The Go) 8 channel general purpose DMA controller 2 SSP controllers, SPI interface, 4 UARTs, 2 CAN channels 3 I2C interfaces, 2-input plus 2-output I 2S (Inter-IC Sound) interface 8 channel 12-bit ADC, 10-bit DAC, motor control PWM 4 general purpose timers, 6-output general purpose PWM, ultra-low power real-time clock (RTC) with separate battery supply • • • • •
• • •
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
How to approach this module? Understand underlying design principles, concepts and protocols, both hardware and software aspects Understand the ARM assembler code and main C libraries which implement the concepts and protocols Use these to create a useful embedded system and application! •
•
•
•
•
Work hard on the 2 Assignments – Make sure you complete each section by the stated time End-of-term Examination
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS
THE END Questions?
EE2024/E Lecture 1: I ntroduction to Microprocessors & ARM © CK Tham, ECE NUS