The 9S12 in Expanded Mode - How to get into expanded mode Huang Chapter 14

Similar documents
The 9S12 in Expanded Mode - How to get into expanded mode Huang Chapter 14

EE 308 Spring 2011 The MC9S12 in Expanded Mode How to get into expanded mode

The 9S12 in Expanded Mode - Using MSI logic to build ports Huang Chapter 14

Using MSI Logic To Build An Output Port

The MC9S12 in Expanded Mode Using MSI logic to build ports Using MSI logic to build an output port Using MSI logic to build an input port

MC9S12 has 16 bit address and 16 bit data buses. Not enough pins on MC9S12 to allocate 35 pins for buses and pins for all other functions

A Simple Parallel Input Port

EE 308 Spring Lecture 28 March 30, 2012 Review for Exam 2. Introduction to the MC9S12 Expanded Mode

PRINCETON (VON NEUMAN) ARCHITECTURE MICROPROCESSOR

The MC9S12 address, data and control buses The MC9S12 single-chip mode memory map Simplified write/read cycle. Address, Data and Control Buses

MC68HC12 Parallel I/O

Input and Output Ports. How do you get data into a computer from the outside?

EE 308 Spring Lab on IIC Bus

Using the MC9S12 in Expanded Mode External Ports S12CPUV2 Reference Manual Multiplexed External Bus Interface (MEBI) Module V3 Block User Guide

HCS12. Microcontrollers. Multiplexed External Bus Interface (MEBI) Module V3. Block User Guide

Lab 2 Part 3 Assembly Language Programming and 9S12 Ports

HC12 Built-In Hardware

Interfacing HCS12 Microcontrollers to the MFR4310 FlexRay Controller David Paterson MCD Applications, East Kilbride

ECE 367 -Experiment #1 Fall 2012

Review for Exam III. Analog/Digital Converters. The MC9S12 has two 10-bit successive approximation A/D converters - can be used in 8-bit mode

Examples of HCS12 External Bus Design A Companion Note to AN2287/D

Roberto Muscedere Images and Text Portions 2003 Prentice Hall 1

The 9S12 in Expanded Mode - External Ports Huang Chapter 14

History of the Microprocessor. ECE/CS 5780/6780: Embedded System Design. Microcontrollers. First Microprocessors. MC9S12C32 Block Diagram

EE4390 Microprocessors. Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System

EE 308 Spring A software delay

Introduction: - Page 1 -

Lecture 10 I/O and Interrupts

Production Programming for HC12 internal Flash

Developing HC11 systems for RAM memory areas:

Introduction to the MC9S12 Hardware Subsystems

University of Florida EEL 4744 Fall 1998 Dr. Eric M. Schwartz

Lecture 15 February 20, 2012 Introduction to the MC9S12 Timer Subsystem What Happens when you Reset the MC9S12. Introduction to Interrupts

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

Introduction. ECE/CS 5780/6780: Embedded System Design. Memory-Mapped I/O. Isolated I/O. Expanded Mode. Multiplexed Address and Data Lines

Lab 25 Solid-State Disk

EE 308 Spring Hello, World!

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.

Review for Exam 3. Write 0x05 to ATD0CTL4 to set at fastest conversion speed and 10-bit conversions

CPU Module EMUL12-PC/CPU-MCS912DP256-xx for the Motorola HCS12 Microcontrollers Operating Instructions by Robert Boys V2.

APPENDIX C D-BUG12 STARTUP CODE

Ryerson University Department of Electrical and Computer Engineering ELE 538 Microprocessor Systems Final Examination December 8, 2003

MC9S12 Address Space

Go Gators! Relax! May the Schwartz be with you!

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING. Principles of Computer Operation

8051 Interfacing: Address Map Generation

C Language Programming, Interrupts and Timer Hardware

8255 Programmable Peripheral Interface Architecture MCT/UNIT III/NARASIMHARAJ/LECTURE NOTES /IV MECH A

HI-WAVE. Serial Debug Interface SDI target. Copyright 1997 HIWARE HI-WAVE

POTENTIOMETER. Revision Class. Instructor / Professor LICENSE

Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3

C Language Programming, Interrupts and Timer Hardware

Introduction to Embedded Systems and Chapter 1: Introduction to HCS12/MC9S12. EE383: Introduction to Embedded Systems University of Kentucky

Basic I/O Interface

PIO 8255 (cont..) M Krishna kumar MAM/M3/LU9e/V1/2004 1

Introduction to the 9S12 Microcontroller

Total: EEL 3701 Digital Logic & Computer Systems Final Exam Fall Semester 2007 COVER SHEET: Re-Grade Information: 1 (10) 2 (10) 3 (10) 4 (14) 5 (14)

Freescale Semiconductor, Inc. Debugger. Serial Debug Interface SDI target. Copyright Metrowerks Debugger

Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3. You will be able to use all of the Motorola data manuals on the exam.

ECE 3610 MICROPROCESSING SYSTEMS AN ENCRYPTED ASCII CODE DECODER

3. The MC6802 MICROPROCESSOR

Address connections Data connections Selection connections

Architecture of 8085 microprocessor

University of Florida EEL 4744 Spring 2012 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering 22 February Jun-12 4:55 PM

Introduction to Microcontrollers

Chapter 2 68HC11 Based Temperature Monitoring Board

Programming Adapt9S12E128 and NC12 with using ubug12

Interfacing Memory Chips on the 6812 Processor Bus. Student's name & ID: Partner's name & ID: Your Section number / TA's name

CMD711-EX Development Board

EE 3170 Microcontroller Applications

MC9S12A256 Device Guide V01.01

General Purpose Programmable Peripheral Devices. Assistant Professor, EC Dept., Sankalchand Patel College of Engg.,Visnagar

CHAPTER 5 : Introduction to Intel 8085 Microprocessor Hardware BENG 2223 MICROPROCESSOR TECHNOLOGY

CPU Module EMUL12-PC/CPU-MC9S12H for the Motorola HCS12 Microcontrollers Operating Instructions by Robert Boys V3.

Chapter Operation Pinout Operation 35

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

Memory & Simple I/O Interfacing

PUSH BUTTON. Revision Class. Instructor / Professor LICENSE

Control Unit: The control unit provides the necessary timing and control Microprocessor resembles a CPU exactly.

Serial Communication Through an Asynchronous FIFO Buffer

CS/ECE 5780/6780: Embedded System Design

EEL 4744C: Microprocessor Applications. Lecture 7. Part 2. M68HC12 Interrupt. Dr. Tao Li 1

Comparison of C and Assembly How to compile a C program using CodeWarrior

EE 3170 Microcontroller Applications

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

Using the stack and the stack pointer

MEMORY, OPERATING MODES, AND INTERRUPTS

AN-HK-32. In-Circuit Programming of FLASH Memory in the MC68HC908GP32. nc... Freescale Semiconductor, I. PART 1 Introduction

AN1745. Interfacing the HC705C8A to an LCD Module By Mark Glenewinkel Consumer Systems Group Austin, Texas. Introduction

CPE/EE 421/521 Fall 2004 Chapter 4 The CPU Hardware Model. Dr. Rhonda Kay Gaede UAH. The CPU Hardware Model - Overview

Allmost all systems contain two main types of memory :

Z8 Pod Adapter. for the. Fluke 9000-Series Troubleshooter

Lecture 20: Interrupt Devices

1. Memory Mapped Systems 2. Adding Unsigned Numbers

Altera FLEX 8000 Block Diagram

EE4380 Microprocessor Design Project

Module 2. Embedded Processors and Memory. Version 2 EE IIT, Kharagpur 1

ASSIGNMENT 4: INTRODUCTION TO THE 68HC11. Out: Monday, Sep 29, 2003 Due Monday, Oct 6, 2003

A+3 A+2 A+1 A. The data bus 16-bit mode is shown in the figure below: msb. Figure bit wide data on 16-bit mode data bus

Freescale Semiconductor, Inc.

Transcription:

The 9S2 in Expanded Mode - How to get into expanded mode Huang Chapter 4 DATA/ADDR (6) HCS2 _ R/W E LSTRB DEMUX ADDR(6) CE _ WE CS _ UB _ LB DATA ADDR CE - Output Enable (Read) _ WE Write Enable CS Chip Enable UB Upper Byte Enable LB Lower Byte Enable The HCS2 has a multiplexed address/data bus, AD5- When in expanded mode the HCS2 uses the pins for PORTA and PORTB as the multiplexed address/ data bus When in expanded mode you cannot use PORTA or PORTB The HCS2 can write one byte or two bytes in one memory cycle Getting Into Expanded Mode The HCS2 can operate in several modes: Normal Single-Chip Mode (the way we have been using the HCS2) Normal Expanded Wide (6-bit address bus, 6-bit data bus) Normal Expanded Narrow (6-bit address bus, 8-bit data bus) Special Single Chip Mode, Special Test Mode, Emulation Expanded Wide Mode, Emulation Expanded Narrow Mode, Special Peripheral Mode

How does the HCS2 know what mode to run in? There are two ways: When you reset the HCS2 it looks at the state of three external pins: MODA, MODB and MODC (BKGD) Based on the logic levels on these three pins the HCS2 goes into one of the eight possible modes: MODC MODB MODA Mode Special Single Chip Emulation Expanded Wide Special Test Emulation Expanded Wide Normal Single Chip Normal Expanded Narrow Peripheral Normal Expanded Wide You can write to the MODE register to change the mode In Normal modes you can switch operating modes once by writing to the MODE register In Normal modes the MODE register is a write-once register Coming out of reset the HC2 checks the state of the following three pins, and starts in one of several modes: BKGD MODB MODA Special Single Chip Emulation Expanded Wide Special Peripheral Emulation Expanded Wide Normal Single Chip (Flash EEPROM on) Normal Expanded Narrow Peripheral Normal Expanded Wide (Flash EEPROM off)

On the EVBU, the HC2 starts in Normal Single Chip After reset, can change modes by writing to MODE register MODC MODB MODA IVIS EMK EME Mode xb Reset Normal Single Chip Need for Normal Expanded Wide In normal modes can change MODE once To switch from Normal Single Chip to Normal Expanded Wide, write to MODC:MODB:MODA Also turn on internal visibility by setting IVIS bit to IVIS = tells the HC2 to display internal bus cycles on the external bus BSET $B,#$E8 The PEAR Register Setting Up the HCS2 For Expanded Mode We will start the HCS2 in Normal Single Chip Mode, and write to the MODE register to switch it into Normal Expanded Wide Mode In Normal Expanded Mode the HCS2 uses the E-clock, the R/W and LSTRB lines for control of the external bus In Normal Single Chip Mode, the HCS2 does not use these control lines, so it sets up their pins for general purpose I/O You need to tell the HCS2 to drive these signals onto external pins When enabled these signals, they are driven onto Port E in order to use the HCS2 in expanded mode You do this by writing to PEAR (Port E Assignment Register) PEAR is a write-once register In Normal Single Chip mode, the E Clock, LSTRB, and R_W

lines are set up as general purpose I/O lines When switched to Normal Expanded Wide need to use these control lines for expanded mode Write to PEAR register: NOACCE PIPOE NECLK LSTRE RDWE PEAR xa Reset Value Single Chip Need for Expanded Wide Write to NECLK to enable E Clock on external pin Write to LSTRE to enable LSTRB on external pin Write to RDWE to enable R_W on external pin MOVB #$C,,$A The MISC Register The MISC (Miscellaneous) register needs to be set up to allow the HCS2 to operate properly in Expanded Mode The MISC register allows you to change the number of clock streches used by the HCS2 The MISC register allows you to disable the Flash EEPROM The MISC register allows you to move the Flash EEPROM to address block x to x7fff When reset the HCS2 forces three E-clock stretches to external data accesses This is useful when using slow memory and peripheral devices We will use a fast peripheral device, so we will speed up external data accesses by forcing the HCS2 to use no E-clock stretches We will leave the Flash EEPROM enabled at its normal address block of x8 to xffff

EXTR EXTR ROMHM ROMON MISC x3 Reset Value Single Chip Need for Expanded Wide Change EXSTR:EXSTR from to to change from three E clock stretches to no E clock strech Leave ROMON at to have DBug2 at x8 xffff Change ROMHM to to turn off Flash EEPROM from x4 to x7fff MOVB #$3,$3 Putting the HCS2 into Normal Expanded Wide Mode To put the HCS2 into Normal Expanded Wide you must write to the MODE, PEAR and MISC registers When D-Bug2 runs, it writes to these registers as part of its start-up code Because these three registers are write-once, you must write to them before DBug-2 does In order to switch to Normal Expanded Wide mode, we will put code to write to these registers in EEPROM and set the jumpers on the EVBU to run out of EEPROM In addition, it is necessary to do some setup which DBug-2 normally does disable the COP (Computer Operating Properly) monitor, and set the bus clock to 24 MHz

PEAR: equ $A MODE: equ $B MISC: equ $3 EPICTL: equ $E INITRM: equ $ SYNR: equ $34 REFDV: equ $35 CRGFLG: equ $37 CLKSEL: equ $39 COPCTL: equ $3C ARMCOP: equ $3F ; PEAR address ; MODE address ; MISC address org $4 ldaa #$55 ;Reset COP staa ARMCOP coma staa ARMCOP clr COPCTL ; Turn off COP ldab #$ ; Map RAM into proper location stab INITRM clr REFDV ; Set clock reference divider to movb #$3,SYNR ; Set PLL to multiply oscillator clock by 4 ; wait l: brclr CRGFLG,#$8,l ; Wait for PLL to lock bset CLKSEL,#$8 ; Switch to PLL clock movb #$e8,mode ; Expanded wide mode, intern vis on movb #$c,pear ; Turn on R/W, LSTRB movb #$,EBICTL ; Use E-clock to control external bus movb #$3,MISC ; No E-clock stretch, disable ROM from ; 4 to 7FFF One-Byte and Two-Byte Data Accesses in Normal Expanded Wide Mode In Normal Expanded Wide Mode the HCS2 can access one byte or two bytes in a single memory cycle A single byte can be located at an even address or an odd address The data lines for bytes at even addresses are connected to AD5-8 lines Because the data for even bytes are accessed through the upper 8 bits of the data bus, these are called Upper Bytes (or High Bytes) The data lines for bytes at odd addresses are connected to AD7- lines

Because the data for odd bytes are accessed through the lower 8 bits of the data bus, these are called Low Bytes The HCS2 can access a High Byte and the following Low Byte in one memory access For such a 6-bit access the upper address lines are the same; only the lower address line is different The HCS2 cannot access a Low Byte and the following High Byte The upper address bits are different for these bytes, and it would be difficult to build a decoder which could deal with this One-Byte and Two-Byte Data Accesses in Normal Expanded Wide Mode To determine whether the HCS2 is trying to access a single High Byte, a single Low Byte, or two bytes (High Byte and following Low Byte) the HCS2 uses the A address line and the LSTRB control line LSTRB = means access low (odd) byte A = means access high (even) byte LSTRB A Access Type 8-bit access of even address (high byte) 8-bit access of odd address (low byte) 6-bit access of even address (high and low byte) Cannot occur Note: LSTRB = and A = would imply access of low (odd) byte and following high (even) byte This will not occur for external data accesses on the HCS2 If the HCS2 needs to access a 6-bit number from an odd address, it will do this in two memory cycles it will access the 8-bit number at the odd address, followed by the 8- bit number at the even address For example the instruction movw #$55aa,$8ff will write the x55 to memory location x8ff on one memory cycle, and the xaa to memory location x9 on the next memory cycle

The HCS2 in Expanded Wide Mode In expanded mode the HCS2 can communicate with external memory and devices over the multiplexed address/data bus To connect an external device to the HCS2 bus you need to identify an unused region of memory By turning off some of the flash EEPROM, the region from address x4 to address x7fff is available We will map an output port to address x4 Need decoder to demultiplex address from data, and to generate control lines needed by output port Output Ports for Lab 5 CS_R A/D 5-8 _ R/W= HCS2 Port A Port B A/D 7- E R/W LATCH ADDR(6) ADDR = x4 OR ADDR = x4 LSTRB = E= R/W = CS_W 8 FF LSTRB Writing to address x4 will bring CS_W low On the high-to-low transition of E, CS_W will go high, latching the data into the flip-flops Reading from address x4 will bring CS_R low This will drive the data from the flip-flops onto the data bus The HCS2 will read the data on the flip-flops on the high-to-low transition of the E-clock

Output Ports for Lab 5 For Lab 5, you need to write an Altera TDF file which will generate two signals: CS_W and CS_R The inputs will be A/D 5-, E, R/W, and LSTRB You need to have a 6-bit latch which will latch the address on the rising edge of E-clock to generate address lines 5-, and an address decoder which will generate CS_W and CS_R when A5-, E, R/W, and LSTRB are in the correct states A part of an Altera TDF file SUBDESIGN Lab5b ( E : INPUT; % E-Clock % RW : INPUT; % R/W % LSTRB : INPUT; % Low-Byte Strobe % PA[7] : INPUT; % Address lines 5-8 from HCS2 (PORTA) % PB[7] : INPUT; % A/D 7- from HCS2 (PORTB) % ) OUT[7] : OUTPUT; % Output port % VARIABLE AD[5] : DFF; % Address Latch % DATA[7] : DFF; % Data FF % TRIBUFFER[7]: TRI; % Tri-state Buffer % CSR, CSW : NODE; % Chip select read and write % BEGIN DEFAULTS CSR = VCC; CSW = VCC; END DEFAULTS; END; % Write some code to implement address latch driven by E-Clock % AD[]clk = E; % Write some code to generate CSR and CSW based on the inputs % % AD, E, LSTRB and RW % CSR = CSW = % Write some code to drive data Flip-Flops by Chip Select Write % DATA[]clk = CSW; % Write some code to feed output back to PORTB % % Enable feedback when CSR low % TRIBUFFER[]oe =!CSR;