I/O Devices & Debugging. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Similar documents
The Embedded computing platform. Four-cycle handshake. Bus protocol. Typical bus signals. Four-cycle example. CPU bus.

Computing platforms. Design methodology. Consumer electronics architectures. System-level performance and power analysis.

Lecture 5: Computing Platforms. Asbjørn Djupdal ARM Norway, IDI NTNU 2013 TDT

CN310 Microprocessor Systems Design

BUS BASED COMPUTER SYSTEM

Dummy FTL. Dong-Yun Computer Systems Laboratory Sungkyunkwan University

Input/Output. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Introduction to Embedded Systems

EMBEDDED SYSTEMS COURSE CURRICULUM

Interrupt/Timer/DMA 1

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

User Manual For CP-JR ARM7 USB-LPC2148 / EXP

Quick Start Guide for the Turbo upsd DK3300-ELCD Development Kit- RIDE

Lab Course Microcontroller Programming

Programming in the MAXQ environment

MB95260H/MB95270H. MB95280H Series. MB95260H Series/MB95270H Series/

Parallel I/O and Keyboard Scanning

(Embedded) Systems Programming Overview

Introduction to ARM LPC2148 Microcontroller

WS_CCESBF7-OUT-v1.00.doc Page 1 of 8

AVR XMEGA TM. A New Reference for 8/16-bit Microcontrollers. Ingar Fredriksen AVR Product Marketing Director

Chapter 4. Enhancing ARM7 architecture by embedding RTOS

Design UART Loopback with Interrupts

Laboratory Exercise 4

Overview of Microcontroller and Embedded Systems

EB-51 Low-Cost Emulator

WS_CCESSH5-OUT-v1.01.doc Page 1 of 7

Microcontroller basics

HZX N03 Bluetooth 4.0 Low Energy Module Datasheet

Chapter 2. Overview of Architecture and Microcontroller-Resources

MicroBolt. Microcomputer/Controller Featuring the Philips LPC2106 FEATURES

Z8 Encore! XP F1680 Series 8-Bit Flash Solution with Extended Peripherals

ELEC 3040/3050 Lab 5. Matrix Keypad Interface Using Parallel I/O

CoLinkEx_LPC11C14 EVB Kit User Guide

ECE 353 Lab 4. General MIDI Explorer. Professor Daniel Holcomb Fall 2015

2-Oct-13. the world s most energy friendly microcontrollers and radios

Computer Systems Laboratory Sungkyunkwan University

Introduction to the OpenSSD Jasmine Platform

ARM Processor. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Am186ER/Am188ER AMD continues 16-bit innovation

Nios Embedded Processor Development Board

UNIT V MICRO CONTROLLER PROGRAMMING & APPLICATIONS TWO MARKS. 3.Give any two differences between microprocessor and micro controller.

Exercise 4-1. DSP Peripherals EXERCISE OBJECTIVES

Veloce2 the Enterprise Verification Platform. Simon Chen Emulation Business Development Director Mentor Graphics

ELEC 3040/3050 Lab 5. Matrix Keypad Interface Using Parallel I/O

TLE9869 Eval.Kit V1.0 Users Manual

ELEC 3040/3050 Lab Manual Lab 2 Revised 8/20/14. LAB 2: Developing and Debugging C Programs in MDK-ARM for the STM32L100RC Microcontroller

AC/DC. Adapter. Serial. Adapter. Figure 1. Hardware Setup

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

MICROPROCESSOR BASED SYSTEM DESIGN

DOMAIN TECHNOLOGIES INC. Users Guide Version 2.0 SB-USB2. Emulator

MSP430. More on MSP430

AGH University of Science and Technology Cracow Department of Electronics

MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine

USING LEDs, LCDs. AND GLCDs IN MICROCONTROLLER PROJECTS. Dogan Ibrahim. Near East University, Cyprus WILEY. A John Wiley & Sons, Ltd.

MSP430 Microcontroller Basics

CEIBO FE-51RD2 Development System

Microcontrollers. Principles and Applications. Ajit Pal +5 V 2K 8. 8 bit dip switch. P2 8 Reset switch Microcontroller AT89S52 100E +5 V. 2.

Lab 3a: Scheduling Tasks with uvision and RTX

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

Debugging in AVR32 Studio

USB Debug Adapter. Power USB DEBUG ADAPTER. Silicon Laboratories. Stop. Run. Figure 1. Hardware Setup using a USB Debug Adapter

NUC123xxxAN Series Errata Sheet. Errata Sheet for 32-bit NuMicro Family Rev May 19, 2016

PSIM Tutorial. How to Use SPI in F2833x Target. February Powersim Inc.

Designing Embedded Processors in FPGAs

VLSI Design Lab., Konkuk Univ. Yong Beom Cho LSI Design Lab

User Manual Rev. 0. Freescale Semiconductor Inc. FRDMKL02ZUM

Real Time Embedded Systems. Lecture 1 January 17, 2012

Hibernation Module. Introduction. Agenda

Laboratory 10. Programming a PIC Microcontroller - Part II

PIC32MX150F128 Breakout Board

Lab 3c Performance Debugging Page 3c.1

AC/DC. Adapter. Ribbon. Cable Serial. Serial. Adapter. Figure 1. Hardware Setup using an EC2 Serial Adapter

5I20 ANYTHING I/O MANUAL

TEVATRON TECHNOLOGIES PVT. LTD Embedded! Robotics! IoT! VLSI Design! Projects! Technical Consultancy! Education! STEM! Software!

PART B UNIT II PART A

4 DEBUGGING. In This Chapter. Figure 2-0. Table 2-0. Listing 2-0.

Network Embedded Systems Sensor Networks Fall Hardware. Marcus Chang,

CEIBO FE-5111 Development System

Product Technical Brief S3C2440X Series Rev 2.0, Oct. 2003

AVR Training Board-I. VLSI Design Lab., Konkuk Univ. LSI Design Lab

Daintree Light Sensor Demo Application Note

PRODUCT PREVIEW TNETV1050 IP PHONE PROCESSOR. description

ARM Microcontroller Interfacing - Warwick A. Smith ISBN Elektor. Table of Contents

AT-501 Cortex-A5 System On Module Product Brief

Embedded Systems - FS 2018

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

Help Volume Agilent Technologies. All rights reserved. Agilent E2485A Memory Expansion Interface

F 2 MC-8FX Family. 8-bit Microcontroller. MB95200 Series

Project Debugging with MDK-ARM

Keil uvision development story (Adapted from (Valvano, 2014a))


Capacitive Touch Based User Interfaces and Hardware-based Solutions

Interrupt and Timer ISRs. Student's name & ID: Partner's name(s) & ID(s): Your Section number & TA's name

Objective: Additional project details: Code: PSEMBP 100 Category:STEM Level: High School/Community C.

PC/104 Multifunction I/O Board Hardware Manual Model 526 Rev.B February 2009

UNIT - II PERIPHERAL INTERFACING WITH 8085

The Freescale MC908JL16 Microcontroller

Embedded Systems Design (630414) Lecture 1 Introduction to Embedded Systems Prof. Kasim M. Al-Aubidy Computer Eng. Dept.

Factsheet 16FX Concept Compatible Platform of 16-bit Microcontrollers

Transcription:

I/O Devices & Debugging Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu

I/O Devices

Jasmine Block Diagram ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 3

Timers and Counters A timer is incremented by a periodic signal A counter is incremented by an asynchronous, occasional signal Rollover causes interrupt ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 4

Jasmine Timers (1) Timer base address at 0x82000000 Four 32-bit countdown timers The clock speed of timer is CLOCK_SPEED/2 (87.5MHz by default) Timer 4 reserved for SATA retry timer In periodic mode, the timer generates an interrupt when the counter reaches zero, and then reloads the initial value. ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 5

Jasmine Timers (2) Timer registers Name Address Usage TM_1_LOAD TM_1_VALUE TM_1_CONTROL TIMER_BASE + 0x00 Initial value of the timer. Reloaded in periodic mode. TIMER_BASE + 0x04 The current value of the timer TIMER_BASE + 0x08 Enable/disable the timer, Set clock prescaling and free-running mode vs. periodic mode TM_1_INT_CLR TIMER_BASE + 0x0c Clear an interrupt generated by the timer ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 6

Jasmine Timers (3) Predefined resolution: Name Input clock divided by Resolution Ticks/sec Time to rollover TIMER_PRESCALE_0 1 11.43 ns 87,489,064 49 s TIMER_PRESCALE_1 16 182 ns 5,494,506 781 s TIMER_PRESCLAE_2 256 2.9 us 344,828 12,455 s Starting and reading a timer: start_interval_measurement (TIMER_CH1, TIMER_PRESCALE_0); UINT32 current = GET_TIMER_VALUE (TIMER_CH1); ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 7

Jasmine Timers (4) Programming a timer start_interval_measurement (TIMER_CH1, TIMER_PRESCALE_0); #define SETREG(ADDR, VAL) \ *(volatile UINT32*)(ADDR) = (UINT32) (VAL) #define GETREG(ADDR) (*(volatile UINT32*)(ADDR)) SETREG (TM_1_CONTROL, 0); SETREG (TM_1_INT_CLR, 0x01); SETREG (TM_1_LOAD, 0xffffffff); SETREG (TM_1_CONTROL, TM_ENABLE TM_BIT_32 TM_MODE_PRD TIMER_PRESCALE_0); ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 8

Jasmine Timers (5) Measuring the elapsed time void ptimer_start (void) { start_interval_measurement (TIMER_CH1, TIMER_PRESCALE_0); } UINT32 ptimer_stop (void) { return (0xffffffff GET_TIMER_VALUE (TIMER_CH1)); } void f (void) { UINT32 ticks; ptimer_start (); do_something (); ticks = ptimer_stop (); } // OK if within 49 sec ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 9

Watchdog Timer Watchdog timer is periodically reset by system timer If watchdog is not reset, it generates an interrupt to reset the host interrupt host CPU reset watchdog timer ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 10

Jasmine Watchdog Timer Watchdog timer at 0x84000000 32-bit down counter with a programmable timeout interval Interrupt output generation on timeout Reset signal generation on timeout if the interrupt from the previous timeout remains unserviced by software Currently not used by Jasmine firmware ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 11

LED Must use resistor to limit current ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 12

7-Segment LCD Display May use parallel or multiplexed input ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 13

GPIO General Purpose Input/Output (GPIO) A generic pin on a chip whose behavior can be controlled through software Each pin can be configured to be input or output Save the hassle of having to arrange additional circuitry to provide additional control lines ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 14

Jasmine GPIOs (1) GPIO base address at 0x83000000 7 GPIO pins (GPIO_0 ~ GPIO_6) 4 GPIO pins (GPIO_2 ~ GPIO_5) can be used to probe signals by a logic analyzer for debugging purpose GPIO_2 ~ GPIO_5 are also used for UART GPIO_0 used for factory mode jumper (J2) GPIO_6 is connected to LED (D4) ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 15

Jasmine GPIOs (2) Controller GPIO Section ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 16

Jasmine GPIOs (3) Factory Mode Jumper (J2) LED Indicator (D4) Setting for UART SW2 pin 1, 2, 3, 4 SW3 pin 1, 2, 3, 4 SW4 pin 1, 2, 3, 4 ON OFF OFF ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 17

Jasmine GPIOs (4) Initializing GPIOs // <init_jasmine() @ target_spw/initialize.c> #if OPTION_UART_DEBUG SETREG (GPIO_DIR, BIT3 BIT4 BIT 6); #else SETREG (GPIO_DIR, BIT6); #endif Reading and writing GPIOs UINT32 temp = GETREG (GPIO_REG); SETREG (GPIO_REG, 0x3); // Set Pins 0 and 1 to HIGH ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 18

Jasmine GPIOs (5) Controlling LED (D4) < target_spw/misc.c> void led (BOOL32 on) { UINT32 temp; } temp = GETREG (GPIO_REG); if (on) temp = (1 << 6); else temp &= ~(1 << 6); SETREG (GPIO_REG, temp); // NOTE: Infinite loop!!! void led_blink (void) { while (1) { led (1); delay (700000); led (0); delay (700000); } } ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 19

Keyboard A switch must be debounced to eliminate multiple contacts caused by mechanical bouncing: ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 20

Encoded Keyboard An array of switches is read by an encoder Contain a microprocessor to preprocess button inputs Reads only one row of switches at a time N-key rollover remembers multiple key depressions ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 21

High-Resolution Display Liquid crystal display (LCD) is dominant form Plasma, OLED, etc. Frame buffer holds current display contents Written by processor Read by video ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 22

Touchscreen Includes input and output device Input device is a two-dimensional voltmeter (resistive touchscreen) ADC voltage ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 23

Development & Debugging

Debugging Challenges Target system may be hard to observe Target may be hard to control May be hard to generate realistic inputs Setup sequence may be complex ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 25

Host/Target Design Use a host system to prepare software for target system: target system host system serial line ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 26

Host-based Tools Cross compiler Compiles code on host for target system Cross debugger (or remote debugger) Displays target state, allows target system to be controlled ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 27

Software Debuggers A monitor program residing on the target provides basic debugger functions Debugger should have a minimal footprint in memory User program must be careful not to destroy debugger program The debugger should be able to recover from some damage caused by user code ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 28

Breakpoints A breakpoint allows the user to stop execution, examine system state, and change state. Replace the breakpointed instruction with a subroutine call to the monitor program ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 29

ARM Breakpoints 0x400 MUL r4,r6,r6 0x404 ADD r2,r2,r4 0x408 ADD r0,r0,#1 0x40c B loop 0x400 MUL r4,r6,r6 0x404 ADD r2,r2,r4 0x408 ADD r0,r0,#1 0x40c BL bkpoint uninstrumented code code with breakpoint ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 30

Breakpoint Handler Save registers Allow user to examine machine Before returning, restore system state Safest way to execute the instruction is to replace it and execute in place Put another breakpoint after the replaced breakpoint to allow restoring the original breakpoint ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 31

Logic Analyzers A logic analyzer is an array of low-grade oscilloscopes ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 32

Boundary Scan Simplifies testing of multiple chips on a board Registers on pins can be configured as a scan chain Used for debuggers, in-circuit emulators ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 33

In-Circuit Emulators A microprocessor in-circuit emulator is a specially-instrumented microprocessor JTAG-based hardware debuggers use onchip debugging hardware with standard production chips Allows you to stop execution, examine CPU state, modify registers ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 34

How to Exercise Code Run on host system Run on target system Run in instruction-level simulator Run on cycle-accurate simulator Run in hardware/software co-simulation environment ICE3028: Embedded Systems Design (Spring 2013) Jin-Soo Kim (jinsookim@skku.edu) 35