Design and Implementation of Timer, GPIO, and 7-segment Peripherals

Similar documents
Design and Implementation of an AHB VGA Peripheral

Design and analysis of microcontroller system using AMBA- Lite bus

o The 9S12 has a 16-bit free-running counter to determine the time and event happens, and to make an event happen at a particular time

Digilent Nexys-3 Cellular RAM Controller Reference Design Overview

o The 9S12 has a 16-bit free-running counter to determine the time and event happens, and to make an event happen at a particular time

EEM Digital Systems II

Laboratory Exercise 4

Microcontrollers. Outline. Class 4: Timer/Counters. March 28, Timer/Counter Introduction. Timers as a Timebase.

UNIVERSITY OF TORONTO JOÃO MARCUS RAMOS BACALHAU GUSTAVO MAIA FERREIRA HEYANG WANG ECE532 FINAL DESIGN REPORT HOLE IN THE WALL

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

Digital (5hz to 500 Khz) Frequency-Meter

EDA385 Bomberman. Fredrik Ahlberg Adam Johansson Magnus Hultin

RAPID SOC PROOF-OF-CONCEPT FOR ZERO COST JEFF MILLER, PRODUCT MARKETING AND STRATEGY, MENTOR GRAPHICS PHIL BURR, SENIOR PRODUCT MANAGER, ARM

SPI Serial Communication and Nokia 5110 LCD Screen

Counter/timer 2 of the 83C552 microcontroller

STA2051E VESPUCCI 32-BIT SINGLE CHIP BASEBAND CONTROLLER FOR GPS AND TELEMATIC APPLICATIONS 1 FEATURES. Figure 1. Packages

Design and implementation (in VHDL) of a VGA Display and Light Sensor to run on the Nexys4DDR board Report and Signoff due Week 6 (October 4)

CSCB58 - Lab 4. Prelab /3 Part I (in-lab) /1 Part II (in-lab) /1 Part III (in-lab) /2 TOTAL /8

Introduction. ECE 153B Sensor & Peripheral Interface Design Winter 2016

Video Output and Graphics Acceleration

Today 3/8/11 Lecture 8 Sequential Logic, Clocks, and Displays

SWITCH: Microcontroller Touch-switch Design & Test (Part 2)

Dynamic Animation Cube Group 1 Joseph Clark Michael Alberts Isaiah Walker Arnold Li

ECE251 Intro to Microprocessors Final Exam December 14, 2015, 2 p.m.

NS8050U MICROWIRE PLUSTM Interface

VARIABLE FREQUENCY CLOCKING HARDWARE

Lecture 14: Computer Peripherals

Raspberry Pi debugging with JTAG

Solutions to Embedded System Design Challenges Part II

Laboratory 4. Figure 1: Serdes Transceiver

SDA 3302 Family. GHz PLL with I 2 C Bus and Four Chip Addresses

VGA 8-bit VGA Controller

S6B CH SEGMENT DRIVER FOR DOT MATRIX LCD

64CH SEGMENT DRIVER FOR DOT MATRIX LCD

CPE 200L LABORATORY 3: SEQUENTIAL LOGIC CIRCUITS UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND: SR FLIP-FLOP/LATCH

Design of a Binary Number Lock (using schematic entry method) 1. Synopsis: 2. Description of the Circuit:

The Micropython Microcontroller

Experiment: FPGA Design with Verilog (Part 4)

LAX_x Logic Analyzer

Lab #10: Building Output Ports with the 6811

Scans and encodes up to a 64-key keyboard. DB 1 DB 2 DB 3 DB 4 DB 5 DB 6 DB 7 V SS. display information.

Hello and welcome to this training module for the STM32L4 Liquid Crystal Display (LCD) controller. This controller can be used in a wide range of

1. Synopsis: 2. Description of the Circuit:

Figure 30.1a Timing diagram of the divide by 60 minutes/seconds counter

TSIU03: Lab 3 - VGA. Petter Källström, Mario Garrido. September 10, 2018

RF4432 wireless transceiver module

LAB #6 State Machine, Decoder, Buffer/Driver and Seven Segment Display

EECS145M 2000 Midterm #1 Page 1 Derenzo

ECE532 Digital System Design Title: Stereoscopic Depth Detection Using Two Cameras. Final Design Report

Chapter 4: One-Shots, Counters, and Clocks

6.111 Project Proposal IMPLEMENTATION. Lyne Petse Szu-Po Wang Wenting Zheng

Traffic Light Controller

PROTOTYPING AN AMBIENT LIGHT SYSTEM - A CASE STUDY

Fast Quadrature Decode TPU Function (FQD)

Task 4_B. Decoder for DCF-77 Radio Clock Receiver

8 X 8 KEYBOARD INTERFACE (WITHOUT INTERRUPT SIGNAL)

Interfacing the TLC5510 Analog-to-Digital Converter to the

Digital Electronics II 2016 Imperial College London Page 1 of 8

RF4432F27 wireless transceiver module

Hello and welcome to this presentation of the STM32L4 Analog-to-Digital Converter block. It will cover the main features of this block, which is used

Preliminary Design Report. Remote Fencing Scoreboard Gator FenceBox

Logic Devices for Interfacing, The 8085 MPU Lecture 4

Digital Blocks Semiconductor IP

KW11-L line time clock manual

Low-speed serial buses are used in wide variety of electronics products. Various low-speed buses exist in different

Logic Analyzer Auto Run / Stop Channels / trigger / Measuring Tools Axis control panel Status Display

Computer Systems Architecture

Laboratory 11. Required Components: Objectives. Introduction. Digital Displays and Logic (modified from lab text by Alciatore)

Step 1 - shaft decoder to generate clockwise/anticlockwise signals

SHA-256 Module Specification

Alice EduPad Board. User s Guide Version /11/2017

PROCESSOR BASED TIMING SIGNAL GENERATOR FOR RADAR AND SENSOR APPLICATIONS

On the Rules of Low-Power Design

Counters

Keyboard Controlled Scoreboard

SOC Implementation for Christmas Lighting with Pattern Display Indication RAMANDEEP SINGH 1, AKANKSHA SHARMA 2, ANKUR AGGARWAL 3, ANKIT SATIJA 4 1

Advanced Devices. Registers Counters Multiplexers Decoders Adders. CSC258 Lecture Slides Steve Engels, 2006 Slide 1 of 20

Lab 3: Timer and Clock

DIGITAL ELECTRONICS: LOGIC AND CLOCKS

Fingerprint Verification System

The Calculative Calculator

Table of Contents Introduction

ECE 372 Microcontroller Design

ECE 532 Group Report: Virtual Boxing Game

EE 209 Lab 7 A Walk-Off

Field Programmable Gate Array (FPGA) Based Trigger System for the Klystron Department. Darius Gray

Laboratory 8. Digital Circuits - Counter and LED Display

Integrated Circuit for Musical Instrument Tuners

Hitachi Europe Ltd. ISSUE : app084/1.0 APPLICATION NOTE DATE : 28/04/99

Design and Implementation of SOC VGA Controller Using Spartan-3E FPGA

IMS B007 A transputer based graphics board

Sequential Logic. Introduction to Computer Yung-Yu Chuang

Revision: August 11, E Main Suite D Pullman, WA (509) Voice and Fax. 8 LEDs. Doc: page 1 of 9

Remote programming. On-Board Computer

LFSRs as Functional Blocks in Wireless Applications Author: Stephen Lim and Andy Miller

PHYSICS 358 Advanced Electronics Laboratory Manual Fall 2014 Dr. Adam T. Whitten

Timing Pulses. Important element of laboratory electronics. Pulses can control logical sequences with precise timing.

HD66766 Rev. 1.0 / 30 November 2001 HD (132 x 176-dot Graphics LCD Controller/Driver for 65K Colors)

6.111 Final Project Proposal Kelly Snyder and Rebecca Greene. Abstract

DE2-115/FGPA README. 1. Running the DE2-115 for basic operation. 2. The code/project files. Project Files

Transcription:

Design and Implementation of Timer, GPIO, and 7-segment Peripherals 1

Module Overview Learn about timers, GPIO and 7-segment display; Design and implement an AHB timer, a GPIO peripheral, and a 7-segment display peripheral; Program peripherals using assembly; Lab Demonstration. System on Chip ARM Cortex-M0 Processor 32-bit Data bus Control signals 32-bit Address bus ARM AMBA 3 AHB-Lite System Bus SRAM controller VGA Peripheral UART Peripheral Timer Peripheral GPIO Peripheral 7-segment Peripheral Off-chip SRAM memory Monitor To host LED 7-Segment Display 2

Module Syllabus Timer Overview Components of a Standard Timer Timer Operation Mode AHB Timer Implementation GPIO Overview AHB GPIO Implementation 7-Segment Display Overview AHB 7-Segment Display Implementation Lab Practice 3

Timer 4

Timer Overview A hardware timer is basically a digital counter that: Counts regular events, which normally refers to a clock source that has a relatively high, and fixed frequency; Increment or decrement at a fixed frequency; Resets itself when reaching zero, or a predefined value; Generates an interrupt when reset; In contrast, a software timer is a similar function block but implemented in software. Software timers usually Are based on hardware timer; Increase or decrease when interrupted by a hardware timer; Offers a lower level of time precision compared with hardware timer; Can have multiple instances that are more than the actual hardware timers. 5

Components of a Standard Timer A prescaler Takes the clock source as its input Divides the input frequency by a predefined value, e.g. 4, 8, 16 Outputs the divided frequency to the other components; A timer register Increases or decreases at a fixed frequency; Driven by the output from the prescaler, often referred as ticks; Capture register Loads the current value from the timer register upon the occurrence of certain events; Can also generate an interrupt upon the events; Compare register Is loaded with a desired value, which is periodically compared with the value in the timer register; If the two values are the same, an interrupt can be generated. 6

Timer Operation Mode Typically, a standard timer may have three operation modes: compare mode, capture mode, and PWM mode. Compare mode example Preload the compare register with a desired value; Timer register is incremented or decremented automatically at a frequency from the output of the prescaler; The values in the compare register and the timer register are automatically compared; once equal, an interrupt can be generated and the timer register should be reset. Compare Register Comparator Interrupt event Prescaler Timer Register Clock source 7

Timer Operation Mode Capture mode The event source generates a sequence of pulses; Optionally, the prescaler can be used to divide the frequency of the events; Once the event (or divided events) occurs, the capture will be enabled; The capture register then takes a snapshot of the timer register at the moment when the event occurs; Optionally, an interrupt can be generated to notify the processor to do some actions. Capture Register Prescaler Capture enable Interrupt event Event source Timer Register 8

Timer Operation Mode Pulse-width modulation (PWM) mode Uses the width of the pulse to modulate an amplitude; The amplitude can be represented by the duty cycle, which describes the proportion of the 1 state in one pulse period; Mainly used for power supplied electrical devices; Pulse frequency ranges from few khz (e.g. motor drive) to hundreds of khz (e.g. audio amplifier, computer power supplies); Voltage Logic 1 Power amplitude Logic 0 Time 9

Timer Operation Mode Example of PWM mode The PWM mode is similar to the compare mode; For example, to generate a 50% power output: Set timer register to reset when reaching 100; Set compare register to 50; In effect, the implementation of the three operation modes can be different between various devices. Compare Register Load with duty cycle Value, e.g. 50 Comparator PWM output Prescaler Timer Register Load reset value e.g. 100 Clock source 10

AHB Timer In this teaching material, we are going to design and implement a simplified timer, which has the following functions: Contains a 32-bits counter that automatically counts downwards once it is enabled; When reaching zero, it is reset to the value in the load value register At the same time, an interrupt is generated. Data [31:0] addr Address decoder Addr[31:0] AHB Interface Data [31:0] Load[31:0] Current[31:0] Control[31:0] 32-bit Counter Control[31:0] Clk Prescaler 11

Timer Registers The timer peripheral should have at least four registers Load value register The reset value when the timer reaches zero; Current value register The current value of the 32-bit counter; Control register Used to start/ stop a counter, and set the prescaler Register Address Size Base address 0x5300_0000 Load value 0x5300_0000 4 Byte Current value 0x5300_0004 4 Byte Control 0x5300_0008 4 Byte 12

General Purpose Input/ Output (GPIO) 13

GPIO Overview General-purpose input/output (GPIO) Used for general purpose, no special usage defined; Widely used for most of the applications; The direction of input/ output is controlled by the direction register; A mask register is often used to mask out certain bits. Direction register Bit [0] out Bit [0] in Bit [1] out Bit [1] in To external devices Bit [2] out Bit [2] in 14

AHB GPIO In this set of material, we will design and implement a simple GPIO peripheral Only has the basic registers, namely data in, data out, and direction register; Does not have a mask register or any other functions. Data[31:0] addr Address decoder Addr[31:0] AHB Interface Data[31:0] Output data[7:0] Input data[7:0] External Devices Control[31:0] Direction[7:0] 15

GPIO Registers The UART peripheral registers include Data registers Input data the data read from external devices; Output data The data sent to external devices; Direction register Controls either it is a read or write operation. Register Address Size GPIO base address 0x5300_0000 Data 0x5400_0000 4 Byte Direction 0x5400_0004 4 Byte 16

7-SEGMENT DISPLAY 17

7-Segment Display Overview The 7-segment display uses 7 segments and a dot to display numerals or letters; Widely used in digital electronic devices, such as digital clocks, electronic meters; Simple control, easy for debugging. 18

AHB 7-Segment Display The implementation of the 7-segment display varies from device to device, for example, Digilent Nexys3 board uses 12 pins to control the 7- segment display: Segment [6:0] -- used to switch on or off one segment; Dot [0:0] -- used to switch the dot bit for one digit; Anode [3:0] -- used to select the four digits, switch on by 0 ; To display different values on four digit, they need to be enabled on one by one. For example, to display 1234, the sequence can be: Anode[3:0]=0111; segment [6:0] = 1 ; Anode[3:0]=1011; segment [6:0] = 2 ; The looping frequency can be set to about 1000Hz, which is Slow enough to allow each anode to switch on; Fast enough to give a vision for human eye that all of the digits are on at the same time. 19

AHB 7-Segment Display The values of the four digits are stored in four registers; The clock frequency is divided to loop the four digits. Data[31:0] addr Address decoder Digit1 [3:0] Addr[31:0] AHB Interface Data[31:0] Digit2 [3:0] Digit3 [3:0] 7-seg dec Segments[7:0] Control[31:0] Clk Frequency divider Digit4 [3:0] Select [1:0] Anode dec Anode [3:0] 20

7-Segment Display Registers The UART peripheral has four registers Digit1: the first digit on the 7-segment display Digit2: the second digit on the 7-segment display Digit3: the third digit on the 7-segment display Digit4: the forth digit on the 7-segment display Register Address Size Base address 0x5500_0000 Digit 1 0x5500_0000 4 Byte Digit 2 0x5500_0004 4 Byte Digit 3 0x5500_0008 4 Byte Digit 4 0x5500_000C 4 Byte 21

Memory Space The memory space for all peripherals is allocated as follow: Peripheral Base address End address Size MEM 0x0000_0000 0x4FFF_FFFF 167MB VGA 0x5000_0000 0x50FF_FFFF 16MB UART 0x5100_0000 0x51FF_FFFF 16MB Timer 0x5200_0000 0x52FF_FFFF 16MB GPIO 0x5300_0000 0x53FF_FFFF 16MB 7-segment 0x5400_0000 0x54FF_FFFF 16MB 22

Lab Practice 23

Lab Practice Step1- Hardware design Design and implement the peripheral (an AHB timer, a GPIO peripheral, and a 7-segment display) in hardware using Verilog; Step2- Software programming Test the peripherals using Cortex-M0 processor programed in assembler language; Step3- System demonstration Input data from switches and output them to LEDs; Display the timer value to the 7-segment display. 24

Useful Resources Reference1 Nexys3 Reference Manual: http://www.digilentinc.com/data/products/nexys3/nexys3_rm.pdf 25