The Insiders's Guide to Planning Xc16x Family Designs
Total Page:16
File Type:pdf, Size:1020Kb
The Insiders’s Guide To Planning XC16x Family Designs An Engineer’s Introduction To The XC166 Family MICHAEL BEACH MIEE DAVID GREENHILL MIIE www.hitex.co.uk/xc Published by Hitex (UK) Ltd. ISBN 0-9549988 2 First published January 2006 Hitex (UK) Ltd. Sir William Lyons Road University Of Warwick Science Park Coventry, CV4 7EZ United Kingdom Credits Authors: Michael Beach David Greenhill Editor: Alison Wenlock Acknowledgements The authors would like to thank Karl Smith, Mike Copeland and Manfred Choutka of Infineon Technologies plus Joachim Klein of Hitex Development Tools GmbH. for their contributions to this book. © Copyright Hitex (UK) Ltd. 19/12/2005 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted in form or by any means, electronic, mechanical or photocopying, recording or otherwise without the prior written permission of the Publisher. © Hitex (UK) Ltd. Page 1 Introduction © Hitex (UK) Ltd. Page 2 Introduction This guide contains basic information that is useful when doing your first XC16x family design. There are many simple facts which, if they are known at the outset, can save a lot of time and money. Overall, it is intended to complement the user manuals by putting things into a practical context. Some of the material can be found in the XC16x family databooks but most of it is simply the result of our practical experience and so is only to be found here. The topics covered are those that are not obvious or are often missed out. Where the user manuals provide a satisfactory explanation, you will be referred back to them, rather than duplicating information here. This is by no means a complete reference work and a lot of additional information can be found on the Infineon website. Note: While every effort has been made to ensure the accuracy of the information contained within this guide, Hitex cannot be held responsible for the consequences of any errors contained therein. Any subjective or anecdotal information presented is not necessarily the official view of either Hitex Development Tools Ltd. or Infineon Technologies AG. Prepared By: Michael Beach David Greenhill With additional material from: Karl Smith, Infineon Technologies UK Joachim Klein, Hitex Development Tools © Hitex (UK) Ltd. Page 3 Contents © Hitex (UK) Ltd. Page 4 Contents Contents 1 RISC Architectures For Embedded Applications 12 1.1 Introduction...............................................................................................12 1.2 Behind The C166S V2’s Near-RISC Core ................................................12 1.2.1 Conventional CISC Bottle-necks ..............................................................13 1.3 The RISC Architecture For Embedded Control.........................................14 1.3.1 Bus Interface ............................................................................................14 1.3.2 RISC Interrupt Response..........................................................................15 1.3.3 Registers And Multi-Tasking.....................................................................15 1.3.4 Coping With RISC Instruction Set (Apparent) Omissions .........................18 1.4 RISC And Real World Peripherals............................................................19 1.4.1 RISC Benefits In Embedded Applications.................................................20 1.5 Traditional RISC v New RISC...................................................................21 2 Getting Started With The XC16x 24 2.1 Basic Considerations................................................................................24 2.1.1 Family Overview .......................................................................................24 2.1.2 Fundamental Design Factors....................................................................24 2.1.3 Setting The CPU Hardware Configuration Options...................................24 2.2 Calculating The Pull-Down Resistor Values .............................................26 2.2.1 Pull-Up Resistor Calculations ...................................................................27 2.3 Start-Up Configuration..............................................................................28 2.3.1 Internal Start Configuration.......................................................................28 2.3.2 External Start Configuration......................................................................29 2.4 Reset Control............................................................................................31 2.5 Clock Speeds And Sources ......................................................................32 2.5.1 PLL Start Up .............................................................................................33 2.5.2 External Bus Start.....................................................................................33 2.5.3 Internal ROM Start....................................................................................34 2.5.4 Choice Of Clock Speed ............................................................................34 2.5.5 Choosing The PLLCON Values ................................................................36 2.6 Generating The Clock...............................................................................38 2.6.1 Designing Clock Circuits...........................................................................38 2.6.2 Oscillator Modules ....................................................................................38 2.6.3 Designing Crystal Oscillator Circuits.........................................................39 2.6.4 Crystal Oscillator Components Test Procedure........................................39 2.6.5 Laying Out Clock Circuits .........................................................................42 2.6.6 Symptoms Of A Poor Clock ......................................................................42 2.7 Real Time Clock Oscillator .......................................................................43 2.8 Further Information On Oscillator Design .................................................43 3 Bus Modes And Timings 44 3.1 Flexible Bus Interface ...............................................................................44 3.1.1 Integral Chip Selects.................................................................................44 3.2 Setting The Bus Mode ..............................................................................45 3.2.1 On-Chip Boot............................................................................................45 3.2.2 External Boot ............................................................................................45 3.3 Setting The Overall Addressing Capabilities.............................................46 3.3.1 External Memory Access Times ...............................................................46 3.3.2 Calculating The Bus Timing Parameters For A Multiplexed Bus ..............47 3.3.3 Calculating The Bus Timing For A Demultiplexed Bus .............................49 3.3.4 A Tool For Calculating The Bus Timing Parameters.................................50 3.3.5 Bus Settings For Commonly-Used Memory Devices................................50 © Hitex (UK) Ltd. Page 5 Contents 4 Interfacing To External Memory Devices 52 4.1 Using 16-Bit Memory Devices ..................................................................53 4.2 Using Byte-Wide Memory Devices In 16-bit XC16x Systems ...................56 4.3 Using The XC16x With Byte-Wide Memories And #BHE..........................57 4.4 Using DRAM With The XC16x Family ......................................................58 4.5 Using FLASH Memory Cards With The XC16x ........................................59 4.5.1 Cheap Gigabyte Storage ..........................................................................59 4.5.2 Using CompactFLASH Cards For XC16x Program Updates ....................59 4.5.3 Interfacing SD/Multimedia Cards ..............................................................60 4.5.4 Interfacing To CompactFLASH.................................................................61 4.5.5 Managing Large FLASH Cards.................................................................61 4.5.6 File System API To Embedded C Programs.............................................62 4.5.7 Resources To Implement A File System On The XC16x..........................62 5 In-Circuit Reprogrammable FLASH EPROM 65 5.1 Introduction...............................................................................................65 5.2 Internal FLASH Layout .............................................................................65 5.2.1 FLASH Identification.................................................................................66 5.3 FLASH Reliability......................................................................................66 5.3.1 Dynamic Error Correction .........................................................................66 5.3.2 FLASH Endurance....................................................................................66 5.4 Managing FLASH Under Extreme Conditions ..........................................67 5.4.1 When To Manage FLASH.........................................................................67 5.4.2 Dynamic Recovery From Double Bit Errors ..............................................68 5.4.3 Predicting Future FLASH Failures ............................................................68 5.5 Tools For Programming