6-1 EE 319K Introduction to Embedded Systems Lecture 6: SysTick Timer, Exam 1 Review Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi,

Slides:



Advertisements
Similar presentations
11-1 Bard, Gerstlauer, Valvano, Yerraballi EE 319K Introduction to Embedded Systems Lecture 11: Data Acquisition, Numerical Fixed-Point Calculations, Lab.
Advertisements

13-1 Bard, Gerstlauer, Valvano, Erez, Telang, Yerraballi EE 319K Introduction to Embedded Systems Lecture 13: 2-D Arrays, Bitmaps, Sprites, Structs, Lab.
EE 319K Introduction to Embedded Systems
The 8051 Microcontroller and Embedded Systems
4-1 EE 319K Introduction to Embedded Systems Lecture 4: Arithmetic overflow, Branches, Control Structures, Abstraction & Refinement Bard, Erez, Gerstlauer,
1-1 Bard, Gerstlauer, Valvano, Yerraballi EE 319K Introduction to Microcontrollers Lecture 1: Introduction, Embedded Systems, Product Life-Cycle, ARM Programming.
Interrupts, Low Power Modes and Timer A (Chapters 6 & 8)
8051 Core Specification.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
EE 319K Introduction to Microcontrollers
10-1 Bard, Tiwari, Telang, Janapa Reddi, Gerstlauer, Valvano, Yerraballi EE 319K Introduction to Embedded Systems Lecture 10: Sampling, Analog-to-Digital.
Computer System Overview
Chapter 6 Programming in Machine Language The LC-3 Simulator
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
Choice for the rest of the semester New Plan –assembler and machine language –Operating systems Process scheduling Memory management File system Optimization.
Topics covered: ARM Instruction Set Architecture CSE 243: Introduction to Computer Architecture and Hardware/Software Interface.
11-1 Bard, Tiwari, Telang, Janapa Reddi, Gerstlauer, Valvano, Yerraballi EE 319K Introduction to Embedded Systems Lecture 11: Data Acquisition, Numerical.
7-1 EE 319K Introduction to Embedded Systems Lecture 7: Phase-locked-loop, Data structures, Finite state machines, Interrupts Bard, Gerstlauer, Valvano,
Computer Organization and Assembly language
16.317: Microprocessor System Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 29: Microcontroller intro.
ECE 424 Embedded Systems Design Lecture 8 & 9 & 10: Embedded Processor Architecture Chapter 5 Ning Weng.
C Programming for Embedded Systems. fig_06_00 Computer Layers Low-level hardware to high-level software (4GL: “domain-specific”, report-driven, e.g.)
ARM Core Architecture. Common ARM Cortex Core In the case of ARM-based microcontrollers a company named ARM Holdings designs the core and licenses it.
2-1 EE 319K Introduction to Embedded Systems Lecture 2: I/O, Logic/Shift Operations, Addressing modes, Memory Operations, Subroutines, Introduction to.
EE 319K Introduction to Embedded Systems
1 © Unitec New Zealand Embedded Hardware ETEC 6416 Date: - 10 Aug,2011.
COE Computer Organization & Assembly Language Talal Alkharobi.
Machine Instruction Characteristics
MICROPROCESSOR INPUT/OUTPUT
Chapter 4 - Implementing Standard Program Structures in 8086 Assembly Language from Microprocessors and Interfacing by Douglas Hall.
© 2004, D. J. Foreman 1 Computer Organization. © 2004, D. J. Foreman 2 Basic Architecture Review  Von Neumann ■ Distinct single-ALU & single-Control.
© 2004, D. J. Foreman 1 Computer Organization. © 2004, D. J. Foreman 2 Basic Architecture Review  Von Neumann ■ Distinct single-ALU & single-Control.
Computer Architecture EKT 422
Introduction to Microprocessors
Ch.2 Intro. To Assembly Language Programming
EE 319K Introduction to Embedded Systems
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
Ch.2 Intro. To Assembly Language Programming From Introduction to Embedded Systems: Interfacing to the Freescale 9s12 by Valvano, published by CENGAGE.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
EE 319K Introduction to Embedded Systems
Execution Architecture MTT CPU08 Core M CPU08 INTRODUCTION.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
An Adder A Subtractor. A and B are the inputs of the adder/ subtractor R is the output of the adder/ subtractor F is the control to tell it to add or.
MICROPROCESSOR DETAILS 1 Updated April 2011 ©Paul R. Godin prgodin gmail.com.
1 Computer Architecture. 2 Basic Elements Processor Main Memory –volatile –referred to as real memory or primary memory I/O modules –secondary memory.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
F28HS Hardware-Software Interface Lecture 11: ARM Assembly Language 5.
Interrupt 마이크로 프로세서 (Micro Processor) 2015년 2학기 충북대학교 전자공학과 박 찬식
Writing Functions in Assembly
EE 319K Introduction to Embedded Systems
ECE 3430 – Intro to Microcomputer Systems
EE 319K Introduction to Embedded Systems
8086 Microprocessor.
Refer to Chapter 3 in the reference book
Introduction of microprocessor
Writing Functions in Assembly
CENG2400 Revision Q1a A system has an ARM processor with a 32-bit General Purpose Input Output (GPIO) module. Two on/off switches are connected to bit-3.
Final Exam Review Department of Electrical and Computer Engineering
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Chapter 8 Central Processing Unit
EE 319K Introduction to Embedded Systems
EECE.3170 Microprocessor Systems Design I
Basics of Embedded Systems IAX0230 Time Interfacing
COMPUTER ORGANIZATION AND ARCHITECTURE
Introduction to Assembly Chapter 2
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

6-1 EE 319K Introduction to Embedded Systems Lecture 6: SysTick Timer, Exam 1 Review Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-2 Agenda  Recap  Subroutines and Parameter Passing oAAPCS Convention  Indexed Addressing and Pointers oIn C: Address of (&), Pointer to (*)  Data Structures: Arrays, Strings oLength: hardcoded vs. embedded vs. sentinel oArray access: indexed vs. pointer arithmetic  Functional Debugging  Outline  Exam 1 Review  SysTick Timer Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-3 Exam 1 Syllabus  Lectures 1, 2, 3, 4, 5 (till slide 10)  Labs 1, 2, 3  Homework 0, 1, 2, 3  Chapters 1-5 from text  Some sections skipped (see HW3)  Look at slides for reference  Chapter 1, 2, 3 from Zyante online book  Worksheets 1, 2, 3, 4, 5 (no arrays) Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-4 Exam 1 Review  Definitions (define in 16 words or less, choose the word, or multiple choice)  volatile, nonvolatile, RAM, ROM, port  static efficiency, dynamic efficiency  structured program, call graph, data flow graph  basis, nibble, precision, kibibyte, mebibyte  signed/unsigned, overflow, ceiling and floor, drop out  bus, address bus, data bus  memory-mapped, I/O mapped  Harvard architecture, von Neumann, pipelining  ALU, D flip-flop, registers  device driver, CISC, RISC  friendly, mask, toggle, heartbeat, breakpoint  Negative logic, positive logic, tristate, open collector  Voltage, current, power, Ohm’s Law Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-5 Exam 1 Review  Number conversions - convert one format to another  alternatives, binary bits  signed decimal e.g., -56  unsigned decimal e.g., 200  binary e.g.,  hexadecimal e.g., 0xC8  Addressing modes (book Sec 3.3.2)  Immediate e.g., MOV R0,#0,  Indexed e.g., LDR R0,[R1] LDR R0,=123  PC-relative e.g., BL subroutine  Register list, e.g., PUSH {R1, R4-R6}

6-6 Exam 1 Review  Cortex-M4 operation & instructions  8-bit addition, subtraction oYielding result, N, Z, V, C  Operation of Thumbnail instructions  Components in address space  Subroutine linkage  Stack operations  Switch and LED interfaces  C Programming  Declarations, expressions, control flow oGlobal variables, Conditionals and Loops  No Arrays on Exam 1 Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-7 Exam1 Review  Simple programs (assembly and C)  create global variables  specify an I/O pin is an input  specify an I/O pin is an output  clear an I/O output pin to zero  set an I/O output pin to one  toggle an I/O output pin  check if an I/O input pin is high or low  add, sub, shift left, shift right, and, or, eor  subroutine linkage Not on Exam –Pointers in C –Arrays, strings –Call by reference –Cycle by cycle execution Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-8 Practice Problems  Book  Hardware interfacing o4.12, 4.13, 4.15  Port initialization o4.5, 4.6, 4.7, 4.10, 4.11  Software (do both in assembly and C) o4.18, 4.19, 4.20, Lab 4.3, Lab 4.5, Lab 4.6, o5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 5.10  Lecture worksheets  Posted w/ lecture notes on class web site  Previous year’s exams  Homework 3  Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-9 Switch Interface Know voltage, current, power Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-10 LED interfaces Know voltage, current, power Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-11 SysTick Timer  Timer/Counter operation  24-bit counter decrements at bus clock frequency oWith 80 MHz bus clock, decrements every 12.5 ns  Counting is from n  0 oSetting n appropriately will make the counter a modulo n+1 counter. That is:  next_value = (current_value-1) mod (n+1)  Sequence: n,n-1,n-2,n-3… 2,1,0,n,n-1… Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-12 SysTick Timer  Initialization (4 steps)  Step1: Clear ENABLE to stop counter  Step2: Specify the RELOAD value  Step3: Clear the counter via NVIC_ST_CURRENT_R  Step4: Set CLK_SRC=1 and specify interrupt action via INTEN in NVIC_ST_CTRL_R Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-13 SysTick_Init ; disable SysTick during setup LDR R1, =NVIC_ST_CTRL_R MOV R0, #0 ; Clear Enable STR R0, [R1] ; set reload to maximum reload value LDR R1, =NVIC_ST_RELOAD_R LDR R0, =0x00FFFFFF; ; Specify RELOAD value STR R0, [R1] ; reload at maximum ; writing any value to CURRENT clears it LDR R1, =NVIC_ST_CURRENT_R MOV R0, #0 STR R0, [R1] ; clear counter ; enable SysTick with core clock LDR R1, =NVIC_ST_CTRL_R MOV R0, #0x0005 ; Enable but no interrupts (later) STR R0, [R1] ; ENABLE and CLK_SRC bits set BX LR SysTick Timer 24-bit Countdown Timer Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-14 SysTick Timer ; SysTick_Wait ; Time delay using busy wait. ; Input: R0 delay parameter in units of the core clock ; 80 MHz(12.5 nsec each tick) ; Output: none ; Modifies: R1 SysTick_Wait SUB R0, R0, #1 ; delay-1 LDR R1, =NVIC_ST_RELOAD_R STR R0, [R1] ; time to wait LDR R1, =NVIC_ST_CURRENT_R STR R0, [R1] ; any value written to CURRENT clears LDR R1, =NVIC_ST_CTRL_R SysTick_Wait_loop LDR R0, [R1] ; read status ANDS R0, R0, #0x ; bit 16 is COUNT flag BEQ SysTick_Wait_loop ; repeat until flag set BX LR Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-15 SysTick Timer ; SysTick_Wait10ms ; Call this routine to wait for R0*10 ms ; Time delay using busy wait. This assumes 80 MHz clock ; Input: R0 number of times to wait 10 ms before returning ; Output: none ; Modifies: R0 DELAY10MS EQU ; clock cycles in 10 ms SysTick_Wait10ms PUSH {R4, LR} ; save R4 and LR MOVS R4, R0 ; R4 = R0 = remainingWaits BEQ SysTick_Wait10ms_done ; R4 == 0, done SysTick_Wait10ms_loop LDR R0, =DELAY10MS ; R0 = DELAY10MS BL SysTick_Wait ; wait 10 ms SUBS R4, R4, #1 ; remainingWaits-- BHI SysTick_Wait10ms_loop ; if(R4>0), wait another 10 ms SysTick_Wait10ms_done POP {R4, PC} Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari

6-16 Bard, Gerstlauer, Valvano, Yerraballi SysTick Timer in C #define NVIC_ST_CTRL_R(*((volatile uint32_t *)0xE000E010)) #define NVIC_ST_RELOAD_R(*((volatile uint32_t *)0xE000E014)) #define NVIC_ST_CURRENT_R(*((volatile uint32_t *)0xE000E018)) void SysTick_Init(void){ NVIC_ST_CTRL_R = 0; // 1) disable SysTick during setup NVIC_ST_RELOAD_R = 0x00FFFFFF; // 2) maximum reload value NVIC_ST_CURRENT_R = 0; // 3) any write to CURRENT clears it NVIC_ST_CTRL_R = 0x ; // 4) enable SysTick with core clock } // The delay parameter is in units of the 80 MHz core clock(12.5 ns) void SysTick_Wait(uint32_t delay){ NVIC_ST_RELOAD_R = delay-1; // number of counts NVIC_ST_CURRENT_R = 0; // any value written to CURRENT clears while((NVIC_ST_CTRL_R&0x )==0){ // wait for flag } // Call this routine to wait for delay*10ms void SysTick_Wait10ms(uint32_t delay){ unsigned long i; for(i=0; i<delay; i++){ SysTick_Wait(800000); // wait 10ms }