| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
2004 Microchip Technology Inc. DS51526A Code protection cons
Top Searches for this datasheetPICDEMFS DEMONSTRATION BOARD USER'S GUIDE 2004 Microchip Technology Inc. DS51526A Code protection constantly evolving. Microchip committed continuously improving code protection features products. Attempts break Microchip's code protection feature violation Digital Millennium Copyright Act. such acts allow unauthorized access your software other copyrighted work, have right relief under that Act. Information contained this publication regarding device applications like provided only your convenience superseded updates. your responsibility ensure that your application meets with your specifications. MICROCHIP MAKES REPRESENTATIONS WARRANTIES KIND WHETHER EXPRESS IMPLIED, WRITTEN ORAL, STATUTORY OTHERWISE, RELATED INFORMATION, INCLUDING LIMITED CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY FITNESS PURPOSE. Microchip disclaims liability arising from this information use. Microchip's products critical components life support systems authorized except with express written approval Microchip. licenses conveyed, implicitly otherwise, under Microchip intellectual property rights. Trademarks Microchip name logo, Microchip logo, Accuron, dsPIC, KEELOQ, microID, MPLAB, PIC, PICmicro, PICSTART, MATE, PowerSmart, rfPIC, SmartShunt registered trademarks Microchip Technology Incorporated U.S.A. other countries. AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB, PICMASTER, SEEVAL, SmartSensor Embedded Control Solutions Company registered trademarks Microchip Technology Incorporated U.S.A. Analog-for-the-Digital Age, Application Maestro, dsPICDEM, dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP, ICEPIC, MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo, PowerMate, PowerTool, rfLAB, rfPICDEM, Select Mode, Smart Serial, SmartTel Total Endurance trademarks Microchip Technology Incorporated U.S.A. other countries. SQTP service mark Microchip Technology Incorporated U.S.A. other trademarks mentioned herein property their respective companies. 2004, Microchip Technology Incorporated, Printed U.S.A., Rights Reserved. Printed recycled paper. 11/12/04 Microchip received ISO/TS-16949:2002 quality system certification worldwide headquarters, design wafer fabrication facilities Chandler Tempe, Arizona Mountain View, California October 2003. Company's quality system processes procedures PICmicro® 8-bit MCUs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory analog products. addition, Microchip's quality system design manufacture development systems 9001:2000 certified. DS51526A-page 2004 Microchip Technology Inc. PICDEMFS USER'S GUIDE Table Contents Preface Chapter Introduction PICDEMFS Board Introduction PICDEM Demonstration Contents Overview PICDEM Demonstration Board PICDEM Board Hardware Features Demo Tool Application Software Chapter Getting Started with PICDEMFS Board Highlights Host Computer Requirements Installing Demonstration Board Chapter Using Demo Tool Application Highlights Software Overview Starting Program Demo Mode Bootload Mode Chapter Using Microchip Firmware Framework Highlights Overview Framework Firmware Framework Chapter Reconfiguring PICDEMFS Hardware Highlights Configuring Demonstration Board Options Restoring PICDEM Firmware Chapter Troubleshooting Highlights Common Problems Appendix PICDEMFS Board Technical Information Highlights Block Diagram PICDEM Board Schematics 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide Appendix PICDEMFS Starter Highlights What's Index Worldwide Sales Service DS51526A-page 2004 Microchip Technology Inc. PICDEMFS USER'S GUIDE Preface NOTICE CUSTOMERS documentation becomes dated, this manual exception. Microchip tools documentation constantly evolving meet customer needs, some actual dialogs and/or tool descriptions differ from those this document. Please refer site (www.microchip.com) obtain latest documentation available. Documents identified with "DS" number. This number located bottom each page, front page number. numbering convention number "DSXXXXXA", where "XXXXX" document number revision level document. most up-to-date information development tools, MPLAB® on-line help. Select Help menu, then Topics open list available on-line help files. INTRODUCTION This chapter contains general information that will useful know before using Chapter Name. Items discussed this chapter include: About This Guide Warranty Registration Recommended Reading Troubleshooting Microchip Site Development Systems Customer Change Notification Service Customer Support 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide ABOUT THIS GUIDE Document Layout This document describes PICDEM demonstration board development tool creating full-speed applications. manual layout follows: Chapter Introduction PICDEMFS Board describes hardware demonstration board used creating solutions. Chapter Getting Started with PICDEMFS Board describes connect demonstration board host system, install Demonstration Tool software. Chapter Using Demo Tool Software describes application both Demo Bootload modes. Chapter Using Microchip Firmware Framework provides overview framework, design solutions. Chapter Reconfiguring PICDEMFS Hardware describes tailor demonstration board hardware your application. Chapter Troubleshooting discusses some common questions about using demonstration board. Appendix PICDEMFS Board Technical Information provides schematics other technical details about demonstration board. Appendix PICDEMFS Starter describes complete contents accompanying software DS51526A-page 2004 Microchip Technology Inc. Preface Conventions Used this Guide This manual uses following documentation conventions: DOCUMENTATION CONVENTIONS Description Arial font: Italic characters Initial caps Represents Referenced books Emphasized text window dialog menu selection field name window dialog menu path dialog button binary number where digit keyboard Sample source code Filenames File paths Keywords Command-line options values variable argument Examples MPLAB® User's Guide only compiler. Output window Settings dialog select Enable Programmer "Save project before build" File>Save Click Click Power `b00100, `b10 Press <Enter>, <F1> Quotes Underlined, italic text with right angle bracket Bold characters `bnnnn Text angle brackets Courier font: Plain Courier Italic Courier 0xnnnn Square brackets Curly brackets pipe character: Ellipses. #define START autoexec.bat c:\mcc18\h _asm, _endasm, static -Opa+, -Opa0, file.o, where file valid filename hexadecimal number where 0xFFFF, 0x007A hexadecimal digit Optional arguments mcc18 [options] file [options] Choice mutually exclusive errorlevel {0|1} arguments; selection Replaces repeated text var_name var_name.] Represents code supplied void main (void) user 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide WARRANTY REGISTRATION Please complete enclosed Warranty Registration Card mail promptly. Sending Warranty Registration Card entitles users receive product updates. Interim software releases available Microchip site. RECOMMENDED READING This user's guide describes PICDEMFS User's Guide. Other useful documents listed below. following Microchip documents available recommended supplemental reference resources. Readme PICDEMFS User's Guide latest information using Chapter Name, read "Readme Chapter Name.txt" file ASCII text file) Readmes subdirectory MPLAB installation directory. Readme file contains update information known issues that included this user's guide. Readme Files latest information using other tools, read tool-specific Readme files Readmes subdirectory MPLAB installation directory. Readme files contain update information known issues that included this user's guide. PIC18F2445/2550/4445/4550 Device Data Sheet (DS39632) This comprehensive reference Microchip's enhanced microcontroller with Full-Speed USB. users already familiar with protocol, data sheet provides basic information needed designing hardware firmware Microchip-based solution. Specification, Revision (USB Implementers Forum, Inc., www.usb.org) developers creating application from ground this comprehensive reference Universal Serial protocol. features USB, from physical electrical specifications data communication protocols device management defined here. TROUBLESHOOTING Chapter "Troubleshooting" information common problems. DS51526A-page 2004 Microchip Technology Inc. Preface MICROCHIP SITE Microchip provides online support site www.microchip.com. This site used means make files information easily available customers. Accessible using your favorite Internet browser, site contains following information: Product Support Data sheets errata, application notes sample programs, design resources, user's guides hardware support documents, latest software releases archived software General Technical Support Frequently Asked Questions (FAQ), technical support requests, online discussion groups, Microchip consultant program member listing Business Microchip Product selector ordering guides, latest Microchip press releases, listing seminars events, listings Microchip sales offices, distributors factory representatives DEVELOPMENT SYSTEMS CUSTOMER CHANGE NOTIFICATION SERVICE Microchip's customer notification service helps keep customers current Microchip products. Subscribers will receive e-mail notification whenever there changes, updates, revisions errata related specified product family development tool interest. register, access Microchip site www.microchip.com, click Customer Change Notification follow registration instructions. Development Systems product group categories are: Compilers latest information Microchip compilers other language tools. These include MPLAB C17, MPLAB MPLAB compilers; MPASMand MPLAB ASM30 assemblers; MPLINKand MPLAB LINK30 object linkers; MPLIBand MPLAB LIB30 object librarians. Emulators latest information Microchip in-circuit emulators.This includes MPLAB 2000 MPLAB 4000. In-Circuit Debuggers latest information Microchip in-circuit debugger, MPLAB MPLAB latest information Microchip MPLAB IDE, Windows® Integrated Development Environment development systems tools. This list focused MPLAB IDE, MPLAB MPLAB SIM30 simulators, MPLAB Project Manager general editing debugging features. Programmers latest information Microchip programmers. These include MPLAB MATE® device programmers PICSTART® Plus development programmer. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide CUSTOMER SUPPORT Users Microchip products receive assistance through several channels: Distributor Representative Local Sales Office Field Application Engineer (FAE) Technical Support Development Systems Information Line Customers should contact their distributor, representative field application engineer (FAE) support. Local sales offices also available help customers. listing sales offices locations included back this document. Technical support available through site http://support.microchip.com addition, there Development Systems Information Line which lists latest versions Microchip's development systems software products. This line also provides information customers receive currently available upgrade kits. Development Systems Information Line numbers are: 1-800-755-2345 United States most Canada 1-480-792-7302 Other International Locations DS51526A-page 2004 Microchip Technology Inc. PICDEMFS USER'S GUIDE Chapter Introduction PICDEMFS Board INTRODUCTION PICDEM Demonstration designed easy-to-use evaluation platform Microchip's Full Speed solution. devices Microchip's family full-speed microcontrollers fully support serial communications Mbit/s.The Demonstration provides hardware software needed demonstrate develop complete communication solution. Items discussed this chapter include: PICDEM Demonstration Contents Overview PICDEM Board PICDEM Board Features Demonstration Tool Software PICDEM DEMONSTRATION CONTENTS Demonstration contains following items: PICDEM demonstration board pre-programmed with bootloader demonstration firmware. standard cable communicating with board. PICDEM Starter CD-ROM, containing driver, Demo Tool application development tools. OVERVIEW PICDEM DEMONSTRATION BOARD microcontroller PICDEM board PIC18F4550, principal device PIC18F2455/2550/4455/4550 family. these devices implement power-saving nanoWatt Technology, enhanced Flash program memory feature modules with following: compliance Full-speed (12Mbit/s) low-speed (1.5Mbit/s) operation Support control, interrupt, bulk isochronous transfers Support endpoints Kbyte dual-access On-chip features true single-chip implementation, including transceiver voltage regulator pull-up resistors Interface off-chip transceiver included reference designs examples Microchip Firmware Framework. This provides services handling lower-level protocol management, control transfer, interrupt handling, hardware register control management. Reference designs included with demonstration cover Human Interface Devices (HID), Communication Device Class (CDC) Microchip General Purpose device class. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide software consists Microchip General Purpose Windows driver, mchpusb.sys, which allows application communicate directly device's endpoints. user-friendly programming interfaces, MPUSBAPI Library, also provided allow easy application development. board comes pre-programmed with default demo application ready evaluation right box. programs downloaded PIC18F4550 microcontroller using pre-programmed bootloader interface. PC-based application, PICDEM Demo Tool, facilitates bootloading process serves host application default demonstration. 1.3.1 Benefits Using PICDEM Board PICDEM demonstration board provides simple advantages: READY-TO-USE DEMONSTRATION: delivered, board ready full-speed operation; that required proper driver (included) Demo Tool application. Users also re-program board with different applications, included Starter evaluate other solutions that tailored their needs. EXPANDABLE PLATFORM: Users also expand hardware capabilities board through expansion headers, even interface with available PICtaildemonstration evaluation daughter boards. PICDEM BOARD HARDWARE FEATURES overall layout board shown Figure 1-1, with list main features following. more complex features discussed detail later this section. FIGURE 1-1: PICDEM BOARD (TOP ASSEMBLY VIEW) Microcontroller: 44-pin, TQFP PIC18F4550 microcontroller (U2) heart demonstration board, provides functionality chip. Refer device data sheet (DS39632) complete discussion microcontroller feature set. Interface Riser: microcontroller surrounded 44-pin (U5), arranged four groups each side. These locations used mount riser interfacing with Microchip's MPLAB 2000/4000 emulator system. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board Oscillator: demonstration board uses crystal oscillator (Y1) primary clock service. PIC18F4550 uses this oscillator generate necessary clock signals both serial interface engine (SIE) core processor. Configuration Jumpers: These three unpopulated jumper positions allow user choose either legacy dedicated ICSPand ports controller. default, board hard-configured legacy port. configuration these jumpers detailed Section 5.2.4 "Adding In-Circuit Emulation Capability". Expansion PICtail Headers: pads provided users install header directly access microcontroller's port signals. addition, even-numbered pins (those right side viewed from top) serve interface Microchip's PICtail daughter boards. This allows PICDEM board used test platform communications interface PICtail boards. Configuration Jumpers: total unpopulated jumper positions provided across board; these allow users modify board configuring hardware suit their needs. default, jumpers bridged features enabled. configuration these jumpers detailed Section "Configuring Demonstration Board Options". Potentiometer: potentiometer (R20) simulates analog input controller. real-time value also displayed Demo Tool host software. Temperature Sensor: Microchip TC77 digital temperature sensor (U4) continuously monitors board's ambient temperature. Data transmitted controller 3-wire interface, displayed real time Demo Tool software. Power LEDs (Green): These light show that power being supplied board, indicate board being powered. indicates that board being powered from bus, while indicates board being powered from separate power supply. Reset Push Button: This switch (S1) tied MCLR PIC18F4550 controller; pressing causes hard device reset. Power Connector: Power VDC) supplied board from external power adapter through mini barrel jack. Using external supply optional, examples provided with demonstration board power from cable. Connector: This standard series receptacle. port primary channel controlling communicating with demonstration board. Connector: This 6-wire RJ11 connector provides standard interface used Microchip development demonstration boards programming debugging applications, using MPLAB other development tools. Status Bank: bank four green LEDs used show operational status board. LEDs used application firmware indicate status connection. other LEDs defined user; they directly controllable through Demo Tool software. User-defined Push Buttons: These switches provided simulate digital control inputs. Pressing either button causes port read `0'. RS-232 (DB9F) Port: standard D-shell connector, along with standard level shifter (U1), provides RS-232 serial connection demonstration board. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide 1.4.1 Oscillator Operating Frequency module PIC18F4550 requires specific clock frequency input operate correctly; specifically, required when operating full-speed mode, when operating low-speed mode. PICDEM board uses crystal oscillator external clock, derives necessary internal clock frequencies from module. clock configuration used demonstration board shown Figure 1-2. detailed explanation setup clock configuration explained Chapter PIC18F4550 device data sheet (DS39632). PICDEM board configured Full Speed mode, generating internal system clock (equivalent MIPS) from external crystal. FIGURE 1-2: PIC18F4550 CLOCK SETUP PICDEM PIC18F4550 Oscillator Block Configurable Input Prescaler (configured divide-by-5) (requires input) Configurable Clock Postscaler (configured divide-by-2) Primary Oscillator Peripherals Clock Fixed Divide-by-2 Clock 1.4.2 Power PICDEM demonstration board operates Power drawn directly from from external power supply. There jumpers select which power source use. Instead, power circuitry automatically selects external power source when both power sources available. LEDs, used indicate active power source. indicates that board operating Power mode; indicates Self Power mode (i.e., external power supply). Note: There power conditions that will cause both light same time. Like most peripherals, PICDEM board powered from available from cable. minimum always available device; maximum requested used available. barrel-type power supply connector (2.5 diameter) also provided board from 9-18 power supply. transformer supplied because every example included will from power. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board host send query device determine currently self-powered. Without ability sense output regulator (VR1), there would determine status power supply. PICDEM board uses microcontroller's pins (PORTA<2:1>) sense which supply available: PORTA<2> monitors regulator, while PORTA<1> senses cable. When port read `1', corresponding power source active. When port read `0', source disconnected. combinations PORTA states shown Table 1-1. more details power requirement management, refer Microchip application note AN950, "Power Management PIC18 Microcontrollers with nanoWatt Technology" (DS00950). TABLE 1-1: PORTA<1> PORTA<2:1> STATE COMBINATIONS THEIR MEANINGS PORTA<2> Status cable power supply both connected; board self-powered, cable attached; board bus-powered, Power supply only attached; board self-powered, 1.4.3 Interface PICDEM board utilizes on-chip voltage regulator, transceivers pull-up resistors PIC18F4550. This helps reduce number external components. connection electrically detached disabling module firmware. disabling module firmware (setting USBEN UCON register `0'), on-chip voltage regulator will also disabled. This simulates physical detachment cable. Figure shows electrical connection interface board. FIGURE 1-3: INTERFACE, SHOWING ON-CHIP COMPONENTS PIC18F4550 (partial) RC4/D2 RC5/D+ VUSB (3.3V) Transceiver Connector VBUS (5V) 3.3V Voltage Regulator 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide 1.4.4 RS-232 Interface PICDEM board fully supports RS-232 serial communications, including hardware flow control (RTS/CTS signalling) generated pins microcontroller. RS-232 female connector supporting circuitry included. 1.4.5 Status LEDs There four firmware-controllable LEDs, through turned when corresponding port value `1', when port `0'. used indicate device status. Table summarizes values relation different device state. meaning each device state found Chapter Specification. Note: bus-powered applications, flashing Suspended mode recommended; current draw likely exceed limits specified Specification. implemented original firmware demonstration board demonstration purposes only. DEVICE STATE STATUS Blink Alternate Flashing Fast Synchronous Flashing TABLE 1-2: Device State Detached Attached Powered Default Addressed Configured Suspended DEMO TOOL APPLICATION SOFTWARE Included with demonstration board Demo Tool software. This simple graphic interface allows users monitor control simple board features, provides ability reprogram PIC18F4550 controller bootloader demonstration. overall operation host software discussed Chapter "Using Demo Tool Application". DS51526A-page 2004 Microchip Technology Inc. PICDEMFS USER'S GUIDE Chapter Getting Started with PICDEMFS Board HIGHLIGHTS This chapter will cover following topics: Host Computer Requirements Installing Demonstration Board HOST COMPUTER REQUIREMENTS communicate with program PICDEM demonstration board, following hardware software requirements must met: PC-compatible system available port CD-ROM drive (for with accompanying Microsoft Windows Second Edition (98SE), Windows 2000 Desktop Windows INSTALLING DEMONSTRATION BOARD device, demonstration board requires very little effort install; most work done operating system. three steps required are: Installing PICDEM software package Connecting PICDEM board Installing driver 2.3.1 Installing PICDEM Software Package software package that accompanies PICDEM board contains software required start using board immediately. includes Demo Tool application, drivers, reference code projects documentation. Installation completely automated, does require user intervention configuration once process started; however, driver installation will require connection board complete. process identical 32-bit Windows operating systems. Users with Windows -based desktops (2000 need have administrative rights their systems this installation, long they have least Power User rights. Closing background applications before proceeding helpful, required. possible, temporarily disable anti-virus software that host system running before installing package, re-enable after installation complete. This also absolutely necessary, helpful some system configurations. Note: possible that some organizations implement desktop computer policy sufficiently restrictive prevent user from loading software all. theory, this done with 32-bit Windows operating system network. this describes your situation, contact your local Information Services provider assistance installing this software. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide install software package: Double-click Computer", then icon CD-ROM. Double-click "MCHPFSUSB_Setup.exe" icon. Installation will proceed automatically, take minutes. Alternatively, installation selecting from Start menu. dialog box, enter: x:\MCHPFSUSB_Setup.exe where drive letter your CD-ROM. installation process will install software package. default, files installed default directory C:\MCHPFSUSB. short software also installed under Programs from Start menu (Programs Microchip PICDEM USB). Note: Using default installation directory (C:\MCHPFSUSB\) allows reference projects retain their original project paths, requires additional configuration during setup. different installation directory used, refer Section 4.2.3 "Configuring MPLAB Framework" update firmware project paths development environment. 2.3.2 Connecting PICDEM Board connect demonstration board Unbox unwrap board, non-conductive surface near host system. Connect cable (supplied kit) open port host system connected host system, connector board. Check board. green Power should lit, status LEDs should flashing rapidly unison. not, check connections port board. additional assistance, refer Chapter "Troubleshooting". 2.3.3 Installing Device Driver Because differences implementation different versions Microsoft Windows, installation driver varies with operating system being used. general, there different procedures: Windows 98SE, Windows 2000 Professional Desktop Windows Desktop. Regardless operating system, should necessary close open applications prior driver installation. Note PICDEM demonstration board configured firmware devices: Demo application Bootload application. driver will install when each application launched first time. possible that some organizations implement desktop computer policy sufficiently restrictive prevent user from adding Plug Play hardware, including devices. This done with 32-bit Windows operating system network, including Windows 98SE. this describes your situation, contact your local Information Services provider assistance installing this software. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board Microsoft Windows 98SE: When cable connected, "Add Hardware Wizard" dialog will appear. Click Next. following dialog (Figure 2-1), will asked choose driver search method. Select "Search Best Driver" option, click Next. FIGURE 2-1: HARDWARE WIZARD, DRIVER SEARCH OPTIONS next dialog (Figure 2-2), select "Specify location" option. Click Browse open Windows Open File dialog. Navigate directory C:\MCHPFSUSB\PC\MCHPUSB Driver\Release click Open. FIGURE 2-2: HARDWARE WIZARD, SELECT DRIVER SOURCE 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide next dialog (Figure 2-3), verify that path displayed correct. Click Next.mchpusb.inf FIGURE 2-3: HARDWARE WIZARD, READY INSTALL DRIVER After brief interval, final Hardware Wizard dialog will confirm that driver been installed. Click Finish. complete installation, allow system restart next dialog. other applications running, click dialog, then close other applications before restarting system. Microsoft Windows 2000 Desktop: When cable connected, "Found Hardware" message appears. After brief interval, this will replaced "Found Hardware Wizard" dialog. Click Next. FIGURE 2-4: HARDWARE MESSAGE DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board "Install Hardware Device Drivers" dialog, select "Search suitable driver" option. Click Next. FIGURE 2-5: HARDWARE WIZARD, DRIVER SEARCH OPTIONS "Locate Driver Files" dialog, select "Specify location" check box. Click Next. next dialog, click Browse button open Windows Locate File dialog. Navigate directory C:\MCHPFSUSB\PC\MCHPUSB Driver\ Release. Click Open accept location, then original dialog (see Figure 2-10). FIGURE 2-6: HARDWARE WIZARD, SPECIFY DRIVER LOCATION "Driver Installation" dialog, confirm that wizard located file mchpusb.inf. Click Next. After brief interval, final Hardware Wizard dialog will confirm that driver been installed. Click Finish. will necessary restart system. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide Microsoft Windows driver installation process similar that Windows 2000, requires fewer steps. After cable connected, initial Hardware Wizard dialog appears (Figure 2-7). Select "Install from list specific locations" option. Click Next. FIGURE 2-7: HARDWARE WIZARD, DRIVER SEARCH OPTIONS "Search Installation Options" dialog, select "Include this location." option. Click Browse button open Windows Browse Folder dialog. Navigate directory C:\MCHPFSUSB\PC\MCHPUSB Driver\ Release.Click accept location, then Next original dialog (see Figure 2-8). FIGURE 2-8: HARDWARE WIZARD, SPECIFY DRIVER LOCATION DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board FIGURE 2-9: HARDWARE WIZARD, BROWSE FOLDER DIALOG system will copy install driver files, indicate when process finished. Click Next. final dialog will indicate that driver been successfully installed. Click Finish. will necessary restart system. Regardless versions operating system, PICDEM demonstration board will appear Device Manager view (available from System applet Control Panel) when installation complete. PICDEM board will appear under category "Other Devices" (Figure 2-10). icon name will same versions Windows. FIGURE 2-10: PICDEM BOARD DEVICE MANAGER VIEW (PARTIAL WINDOW SHOWN) 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide 2.3.4 Confirming Operation Power external power supply being used) flashing, generally assumed that demonstration board hardware working correctly. However, useful verify that board actually communicate with host system using Demo Tool application. this: Launch Demo Tool application clicking "PICDEM Demo Tool" icon. Select Demo Mode access Demo Mode controls (Figure 2-11). "Select PICDEM Board" dropdown list, select "PICDEM (Demo)". Click Connect button. temperature number should appear "Real Time Temperature" window almost immediately. appropriate temperature appears, demonstration board ready your use. FIGURE 2-11: DEMO MODE WINDOW (PARTIAL VIEW) DS51526A-page 2004 Microchip Technology Inc. PICDEMFS USER'S GUIDE Chapter Using Demo Tool Application HIGHLIGHTS items discussed this chapter are: Software Overview Starting Program Demo mode Bootload mode SOFTWARE OVERVIEW PICDEM Demo Tool (more simply, PDFSUSB "Demo Tool") Windows-based software application designed used with PICDEM board evaluating Microchip's Full-Speed solutions. Using this software, evaluate features performance offered PIC18F4550 microcontroller. There modes available: Demo mode Bootload mode. Demo mode demonstrates communication from host through typical embedded system setup. application shown includes data logging, real-time sensing, control peripheral components. Bootload Mode allows designers download evaluate different firmware program without using additional external programmer. Demo Bootloader separate applications. Both programs totally separate share functions descriptors. Bootloader code write-protected cannot overwritten firmware. external programmer such MPLAB required erase Bootloader. programs also have different product (but same Vendor ID). reference, product are: Bootload: 0x04D8, 0x000B Demo: 0x04D8, 0x000C Note: Because Demo Bootloader different applications, they treated devices. Microchip driver will attempt install when each applications launched first time. procedure described previous chapter, driver Demo application installed. driver Bootload application will begin installation first launch. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide STARTING PROGRAM demo board shipped from factory with default demonstration firmware program bootloader. case that demonstration program been overwritten, restore firmware using bootloader external programmer such MPLAB Demo Tool application, select Programs Microchip PICDEM PICDEM Demo Tool from Start menu. Alternatively, double-click PDFSUSB icon shortcut. will Demo Tool window (Figure 3-1). default, application launches Bootload mode. switch Demo mode, click "Demo Mode" (Figure 3-2). FIGURE 3-1: DEMO TOOL WINDOW, BOOTLOAD MODE FIGURE 3-2: DEMO TOOL WINDOW, DEMO MODE DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board DEMO MODE Demo mode provides simple interface between board host system demonstrate connectivity. start using application, select "PICDEM (Demo)" from "Select PICDEM Board" dropdown box. Click "Connect" button upper right hand corner. When Demo Tool application successfully connects board, message "USB Demo Firmware Version x.x" will appear left side status bottom window. There three interactive features this mode. Temperature Display There temperature modes: Real Time Data Logging. Real Time mode, temperature data streamed from board continuously. Both temperature graph temperature value updated periodically. data displayed centigrade unit with graph display range 16°C 36°C. easiest change temperature lightly blow (warm cold) sensor (U4). Data Logging mode, temperature data sent host continuously. Instead, temperature data sampled every second stored data memory buffer until "Acquire Data" button clicked. that point, firmware sends everything buffer then empties buffer. Data acquired time; time elapsed since last acquisition less than seconds, then smaller data points will acquired displayed message window. Clicking "Acquire Data" rapidly return "WARNING-No Data Acquired" message; this only means that controller opportunity collect temperature sample. data points displayed time; temperature graph also updated that time. Clicking "Clear Screen" clears message window. firmware store data points; therefore takes seconds fill data memory buffer. When buffer becomes full, firmware replaces oldest data point with newer data value. FIGURE 3-3: MESSAGE WINDOW DATA LOGGING MODE Toggle LEDs Toggle LEDs contains buttons used control status demonstration board. corresponding turned when button pressed when same button pressed again. Potentiometer Display Potentiometer Display reflects current value potentiometer demonstration board. value ranges from Turning potentiometer board causes analog dial gauge digital display change accordingly real time. Ending Demo Mode stop demonstration program, click "Disconnect" exit application. Clicking "Bootload Mode" also terminates Demo mode. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide BOOTLOAD MODE Bootload mode provides simple means re-programming on-board microcontroller without using external programming device. PICDEM board pre-programmed with bootload program that allows designers download test code through Demo Tool application. This section describes Bootload mode, well brief overview architecture bootload program. understanding bootload firmware coexists with user firmware important developing successful application. 3.5.1 Bootload Mode Entry start using application, press hold while resetting board (pressing releasing S1). entry condition PICDEM board provided firmware determined status switch button which checked once after each reset. button held down during Reset, microcontroller enters bootload mode; otherwise, starts executing user code from address 0x0800. Note: Even Demo Tool application running Bootload mode, simple reset board (pressing will cause board itself enter Bootload mode. After reset, select "PICDEM (Boot)" from "Select PICDEM Board" dropdown box. When Demo Tool application successfully connects board, message "USB Bootload Firmware Version x.x" will appear left side status bottom window. 3.5.2 Memory Organization Program Memory Usage Figure shows memory PIC18F4550. first 2,048 bytes program memory reserved boot block, which utilized almost entirely bootloader firmware. bootloader self-contained program with driver firmware, descriptor set, bootload command interpreter, bootload function handlers. driver firmware used with Bootloader modified version Microchip Firmware Framework library, incorporates smaller features more static design. boot block write protected prevent accidental overwriting boot program. default setting from factory boot block write protect option enabled. Remapped Vectors Since hardware reset interrupt vectors within boot area cannot edited block write-protected, they remapped through software nearest parallel location outside boot block: 0x0800 Reset, 0x0808 High Priority Interrupt vector, 0x0818 Priority vector. Remapping simply GOTO instruction interrupts. Users should note that additional latency instruction cycles required handle interrupts. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board Memory Spaces There four memory spaces that bootloader access program. Program Memory (0x0800 0x7FFF) User Memory (0x200000 0x200007) EEPROM Memory (0x0F0000 0x0F00FF) Configuration Memory (0x300000 0x30000D) Bootload also reads displays read-only Device words 0x3FFFFE 0x3FFFFF. Note: data EEPROM actually located different memory space than shown here. address range given remapped bootloader proper memory when data EEPROM access required. PIC18F4550 PROGRAM MEMORY (BOOTLOADER IMPLEMENTED) 0000h Bootloader Area 07FFh 0800h 0808h 0818h Bootloader Memory Space FIGURE 3-4: Reset Vector High Priority Interrupt Vector Priority Interrupt Vector User Memory Space Program Memory 7FFFh 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide 3.5.3 Using Bootloader Once board been selected dropdown list, bootloader control buttons become active (Figure 3-5). FIGURE 3-5: BOOTLOAD MODE CONTROLS Load File: This loads file into memory buffer displays content message window. data loaded used program target device. valid file must conform Intel format. invalid file selected, warning message, "WARNING file data.", displayed. device configuration data present, bootloader firmware will check configuration conflicts that might disable board. These discussed more detail Section 3.5.4 "Consideration When Using Bootloader". Each project's file, MCHPUSB.hex, found `_output' directory, i.e., C:\MCHPFSUSB\fw\Cdc\_output Read Device: Read Device function reads entire memory range into memory buffer displays content message window. Program memory, EEPROM, User configuration data read. successful read operation indicated message "MESSAGE Read Completed" Message window. operation failed, warning, "WARNING Failed read", shown. Erase Device: Erase Device function erases user program memory space only (0x0800 0x7FFF). does erase EEPROM, User configuration data. Execute: Execute function sends Reset command bootloader firmware, causing microcontroller reset. pressed during this time, user code program memory will start executing; otherwise, firmware will re-enter bootload mode. operation failed, perform hard reset demo board pressing Save File: Save File function saves data contained memory buffer file, whether loaded from Read Device Load file functions. only saves data type present memory buffer. file loaded does have particular type memory, i.e., EEPROM, that data section will saved output file. memory sections always loaded after Read Device function. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board Program Device: Program Device function programs target device with data loaded memory buffer. Only type memory present memory buffer will programmed. function automatically erases program memory (0x0800 0x7FFF) User memory (0x200000 0x200007) before writing data these locations. Memory contents verified after write operation. Abort Operation: Abort Operation function enabled when programming, reading, erasing device. This function causes current operation terminate. 3.5.4 Consideration When Using Bootloader PIC18F4550 microcontroller PICDEM board specific configuration setting that necessary bootload program function. Voltage Regulator device oscillator settings both critical, cannot changed. Other settings, such code protection, LVP, less critical cause irreversible side effects. default configuration values shown Table 3-1. configuration data contained file violate restrictions critical configuration settings described above. Should this happen, Demo Tool will display warning dialog (Figure 3-6). This will also accompanied brief text description configuration conflict. Users have option accept configuration settings, board's factory configuration settings, maintain current configuration setting. TABLE 3-1: Address 0x300000 0x300001 0x300002 0x300003 0x300005 0x300006 0x300008 0x300009 0x30000A 0x30000B 0x30000C 0x30000D Note: DEFAULT CONFIGURATION WORD VALUES PICDEM BOARD Register CONFIG1L CONFIG1H CONFIG2L CONFIG2H CONFIG3H CONFIG4L CONFIG5L CONFIG5H CONFIG6L CONFIG6H CONFIG7L CONFIG7H Value 0x24 0x0E 0x3F 0x1E 0x81 0x81 0x0F 0xC0 0x0F 0xA0 0x0F 0x40 Comment Clock configuration Clock configuration BOR, PWRT, voltage regulator configuration MCLR, CCP2, configuration Core microcontroller configuration Code protect (program memory) Code protect (boot block/EEPROM) Write protect (program memory) Write protect (boot block/EEPROM) Table Read protect (program memory) Table Read protect (boot block/EEPROM) Only implemented configuration words listed. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide FIGURE 3-6: CONFIGURATION CONFLICT WARNING DIALOG WITH TYPICAL DIAGNOSTIC MESSAGE When file loaded, either from device file, Bootloader demo software also parses file determine code available different memory areas. device programmed with that file, only those memory areas with code present programmed; other memory areas left unchanged. example, file that missing data data EEPROM configuration words will only program target device's program memory User spaces; existing configuration stored EEPROM information will preserved. 3.5.5 Writing Application Code with Bootloader bootloader operates separate entity, which means that application developed with very little concern about what bootloader doing. This should bootloader should dormant code until event initiates operation. Ideally, bootloader code should never running during application's intended normal operation. When developing application with resident bootloader, some basic principles must kept mind: 3.5.5.1 WRITING ASSEMBLY When writing assembly, boot block vectors must considered. modular code, this usually just matter changing linker script file project. example shown Example 3-1. absolute address assigned code section, address must point somewhere above boot block. those write absolute assembly, that necessary remember that Reset vector 800h, interrupt vectors 808h 818h. Except bootloader, code should reside boot block area. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board EXAMPLE 3-1: ASSEMBLY LINKER SCRIPT WITH BOOTLOADER Sample linker command file 18F4550 with Bootloader LIBPATH CODEPAGE CODEPAGE CODEPAGE CODEPAGE CODEPAGE CODEPAGE NAME=boot NAME=page NAME=idlocs NAME=config NAME=devid NAME=eedata START=0x0 START=0x800 START=0x200000 START=0x300000 START=0x3FFFFE START=0xF00000 START=0x0 START=0x60 START=0x100 START=0x200 START=0x300 START=0x400 START=0x500 START=0x600 START=0x700 START=0xF60 ROM=config END=0x7FF END=0x7FFF END=0x200007 END=0x30000D END=0x3FFFFF END=0xF000FF END=0x5F END=0xFF END=0x1FF END=0x2FF END=0x3FF END=0x4FF END=0x5FF END=0x6FF END=0x7FF END=0xFFF PROTECTED PROTECTED PROTECTED PROTECTED PROTECTED ACCESSBANK NAME=accessram DATABANK NAME=gpr0 DATABANK NAME=gpr1 DATABANK NAME=gpr2 DATABANK NAME=gpr3 DATABANK NAME=usb4 DATABANK NAME=usb5 DATABANK NAME=usb6 DATABANK NAME=usb7 ACCESSBANK NAME=accesssfr SECTION NAME=CONFIG PROTECTED PROTECTED PROTECTED PROTECTED PROTECTED 3.5.5.2 WRITING When using MPLAB compiler develop firmware application, user choice either rebuild standard start-up object (c018.o c018i.o) with Reset vector, insert extra code shown Example 3-2. latter method recommended. Like modular assembly, linker file must changed incorporate protected boot block vectors. example shown Example 3-3. users other compilers, check with compiler's software user guide determine change start-up code vectors. EXAMPLE 3-2: RESET VECTOR INSERT APPLICATIONS extern void _startup (void); c018i.c your compiler directory #pragma code _RESET_INTERRUPT_VECTOR 0x000800 void _reset (void) _asm goto _startup _endasm #pragma code 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide EXAMPLE 3-3: LINKER SCRIPT WITH BOOTLOADER Sample linker command file 18F4550 with Bootloader LIBPATH FILES c018i.o FILES clib.lib FILES p18f4550.lib CODEPAGE CODEPAGE CODEPAGE CODEPAGE CODEPAGE CODEPAGE CODEPAGE NAME=boot NAME=vectors NAME=page NAME=idlocs NAME=config NAME=devid NAME=eedata START=0x0 START=0x800 START=0x82A START=0x200000 START=0x300000 START=0x3FFFFE START=0xF00000 START=0x0 START=0x60 START=0x100 START=0x200 START=0x300 START=0x400 START=0x500 START=0x600 START=0x700 START=0xF60 ROM=config RAM=gpr3 END=0x7FF END=0x829 END=0x7FFF END=0x200007 END=0x30000D END=0x3FFFFF END=0xF000FF END=0x5F END=0xFF END=0x1FF END=0x2FF END=0x3FF END=0x4FF END=0x5FF END=0x6FF END=0x7FF END=0xFFF PROTECTED PROTECTED PROTECTED PROTECTED PROTECTED PROTECTED ACCESSBANK NAME=accessram DATABANK NAME=gpr0 DATABANK NAME=gpr1 DATABANK NAME=gpr2 DATABANK NAME=gpr3 DATABANK NAME=usb4 DATABANK NAME=usb5 DATABANK NAME=usb6 DATABANK NAME=usb7 ACCESSBANK NAME=accesssfr SECTION NAME=CONFIG PROTECTED PROTECTED PROTECTED PROTECTED PROTECTED STACK SIZE=0x100 example user program provided reference project used with bootloader. firmware example found C:\MCHPFSUSB\fw\Demo02. DS51526A-page 2004 Microchip Technology Inc. PICDEMFS USER'S GUIDE Chapter Using Microchip Firmware Framework HIGHLIGHTS items discussed this chapter are: Overview Framework Firmware Framework OVERVIEW FRAMEWORK Microchip Firmware Framework file system construct that used create applications. thought reference design project, containing necessary firmware code operation providing placeholder user's code. whole code project contained within single root project directory, with many subdirectories source code organization. Framework based latest versions this written) Microchip's development tools. provide best level application support, should verify that have least these revisions following tools before starting: MPLAB IDE, 6.62 Microchip Complier, 2.30.01 This section describes importance setting project paths framework organized. 4.2.1 Framework Directory Structure file structure consists collection subdirectories specific files under root project directory. root directory project located location have valid directory name; however, subdirectories structure should always maintained. Each example projects included with PICDEM demonstration board uses this structure. following subdirectories files should always present: Subdirectories: _output: Central location output files autofiles: Contains global configuration file descriptors system: Contains firmware user: Placeholder user's firmware Files: CleanUp.bat: Delete output files this folder subdirectories. io_cfg.h: Maps names functions; this file should modify match each target board. default example designed PICDEM demonstration board. main.c: file which contains main() application MCHPUSB.mcp: MPLAB Project file MCHPUSB.mcw: MPLAB Workspace file 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide 4.2.2 Framework Logical Structure Firmware Framework also provides modular firmware interfaces that handle most work implementing communications. Figure shows typical program flow. Each firmware reference project written have cooperative multitasking environment; thus, blocking functions should implemented. main() function infinite while loop that services different tasks. These logically thought either task user task. tasks handled USBDriverService(), which polls services hardware interrupts. When control endpoint transaction received, USBCtrlEPService() called. transfers over default control endpoints must follow control transfer protocol described specification. control transfer service provided functions usbctrltrf.c. first stage control transfers arrive request. request either standard class-specific. standard request serviced USBCheckStdRequest(), which handles required requests specified Chapter specification. class-specific request must handled firmware file that knows service Examples device classes Human Interface Device (HID) Communication Device Class (CDC). (The example Figure shows HID; could refer other device class just easily.) handlers class specific request should contained specific device class firmware file, such hid.c cdc.c. naming scheme function that services class specific request USBCheck<class name>Request(), where <class name> class specific names. enumeration process handled mainly usb9.c. most important steps enumeration process handling SET_CONFIGURATION request, which done USBStdSetCfgHandler(). This function modified user call appropriate functions initialize application endpoints. Each specific device class firmware should have endpoint initialization routine. naming convention this function <class name>InitEP(), where <class name> device class names. example HIDInitEP(), which contains example code initialize group endpoints that used class. Users should take care check which configuration index being asked host. device have multiple configurations, interfaces same across different configuration. user's application code also called from main program loop; resides under default function name ProcessIO(). When application needs send receive transaction, call pre-written function that services transmit receive functionality which declared class specific firmware code, such HIDRxReport()and HIDTxReport(). device configuration also handled modular manner, modifying variables small number files; information then made globally available compile time. files tightly interdependent, pass information between themselves during compile time create complete configuration. relationships shown Figure 4-2. Customizing configuration files discussed Section "USB Firmware Framework". DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board FIGURE 4-1: RELATIONSHIPS BETWEEN MICROCHIP FRAMEWORK FILES TYPICAL APPLICATION Program Memory main.c main.c while(1) usbdrv.c USBDriverService() usbdsc.c usbctrltrf.c USBCtrlEPService() usb9.c USBCheckStdRequest() USBStdSetCfgHandler() hid.c USBCheckHIDRequest() user.c ProcessIO() HIDInitEP() Functions usbcfg.h Configuration Data Memory usbmmap.c Mapping FIGURE 4-2: COMPILE-TIME RELATIONSHIPS BETWEEN CONFIGURATION FILES User Configurable Files usbdcs.c usbdsc.h Descriptor Information usbcfg.h Configuration MAX_EP_NUMBER Endpoint Buffer Descriptor Registers Endpoint sizes usbmmap.c Mapping Abstract Endpoint Definitions Endpoint Buffer Variables Class-Specific Firmware Files hid.c cdc.c, etc.) 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide 4.2.3 Configuring MPLAB Framework When setting project from reference design, first thing check project paths. These should updated reflect actual project's root directory needed. steps updating project paths will demonstrated through example. this example, will Mouse Reference project, located directory C:\MCHPFSUSB\fw\HID\Mouse. need adjust your target directories according where project actually located during installation. open project workspace: Launch MPLAB. From MPLAB menu bar, select File Open Workspace. Navigate select project file C:\MCHPFSUSB\fw\HID\Mouse\ MCHPUSB.mcw. Return menu select Project Build Options. Project. Build Options dialog appears (Figure 4-3). Click General verify following: "Output Directory" "Intermediates Directory" paths should point _output folder under your root project directory. "Include Path" directory should point project's root directory. "Library Path" should point "lib" directory under program folder. "Linker-Script Path" should point directory project's linker script file. Note some cases, compiler fail compile correctly, giving error that certain header files from mcc18 library could found. this case, path C:\mcc18\h after project root path "Include Path" field (separated with semicolon). compiler installed path other than C:\mcc18\, actual path should used instead. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board FIGURE 4-3: CONFIGURING MPLAB MICROCHIP FRAMEWORK 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide FIRMWARE FRAMEWORK subdirectories autofiles system contain firmware source code framework. Some these files should never modified, while others must edited configure application. Each folder files will discussed details what they modify them match your application. 4.3.1 Autofiles Directory This directory contains three configuration files operation: usbcfg.h: Global Configuration File usbdsc.c: Descriptor File usbdsc.h: Descriptor File Header 4.3.1.1 USBCFG.H This header file most important file entire project. defines endpoints mapping their class functions. also defines Microchip (MUID) number, which used determine which class currently owns control transfer progress. Finally, defines maximum buffer size endpoint centralize configuration important features, USB-related compile time options found here. file constructed series #define compiler directives. options configure are: EP0_BUFF_SIZE [buffer_size] MAX_NUM_INT [max] MODE_PP [_PPBMn] UCFG_VAL [option1 option2.] USE_SELF_POWER_SENSE_IO USE_USB_BUS_SENSE_IO USB_USE_GEN USB_USE_CDC USB_USE_HID MAX_EP_NUMBER [max_ep] EP0_BUFF_SIZE defines buffer size endpoint have valid value bytes. This definition used globally project many things. used during project build allocate appropriate buffer size endpoint used descriptor notify host size endpoint buffer. also used during control transfer operation. When defining this variable, note that low-speed device only 8-byte buffer, while Full-Speed device 64-byte buffer. MAX_NUM_INT defines size array which keeps track active alternate setting each interface, which switched during operation. Valid values integers 2,.]. device multiple configurations, number interfaces from configuration with highest number interfaces should used. example, device with configurations three interfaces first configuration interfaces second. this case, MAX_NUM_INT should three. MODE_PP defines ping-pong buffer mode used during runtime. allowed values _PPBM0, _PPBM1 _PPBM2; each these turn defined header usbdrv.h. function each mode explained PIC18F2455/2550/4455/4550 device data sheet. Note: current version firmware only supports _PPBM0 mode. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board UCFG_VAL defines initial value UCFG special function register. allowed values are: _FS: Select Low- Full-speed mode _TRINT _TREXT: Select Internal External Transceiver mode _PUEN: internal pull-up resistor _OEMON: output indicator _UTEYE: Enable eye-pattern test output options ORed together (for example, #define UCFG_VAL _PUEN|_TRINT|_FS). This value used firmware framework initialize UCFG register. full explanation options found description UCFG register PIC18F2455/2550/4455/4550 device data sheet. Note option selected, device clock configuration must changed support Speed operation, Refer device data sheet additional information. _UTEYE option used only device testing, never live applications. When _UTEYE enabled, device transmits continuously. plug device host when option enabled. USE_SELF_POWER_SENSE_IO indicates that microcontroller sensing presence on-board power through pin. target board design does detect present self-power, this definition must commented out. USE_USB_BUS_SENSE_IO indicates that firmware will defined io_cfg.h determine when enabled module. target board design does detect present bus, this definition must commented out. When USE_USB_BUS_SENSE_IO undefined, module will always enabled. Using this feature helps improve power efficiency system because module only enabled when present. USB_USE_GEN, USB_USE_CDC USB_USE_HID used indicate which classes should included code project. When each these defined, tells global header file usb.h which class-specific header files include. usb.h header used globally necessary include file when using library. class used, then hid.c hid.h should also added MPLAB project. class used, then cdc.c cdc.h should also added MPLAB project. This definition also used when SET_CONFIGURATION request received. User modify `Modifiable Section' USBStdSetCfgHandler function usb9.c. calls located modifiable section initialize endpoints used each specific class, which mapped usbcfg.h. MAX_EP_NUMBER must equal highest endpoint number used project. example, highest endpoint number used endpoint then MAX_EP_NUMBER should equal five. This definition used mainly usbmmap.c allocate buffer descriptor registers. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide 4.3.1.2 USBDSC.C USBDSC.H These files contain descriptor information device. main file, usbdsc.c, defines descriptor itself; usbdsc.h defines descriptor structure, which used calculate descriptor size with sizeof() statement. When descriptor added removed from main configuration descriptor, (i.e., CFG01), user must also change descriptor structure defined usbdsc.h. typical configuration descriptor consists these components: least configuration descriptor (USB_CFG_DSC) more interface descriptors (USB_INTF_DSC) more endpoint descriptors (USB_EP_DSC) addition, there usually descriptor string that provides plain text description device. 4.3.1.2.1 Customizing USBDSC.C version usbdsc.c included with Framework Firmware indicates which parameters must defined, serve template developing device descriptors. Most items should self-explanatory, some options explained file's comments expanded upon below. USB_CFG_DSC configuration attribute (the item immediately following string index) must always have _DEFAULT definition minimum. additional options, _SELF _RWU, ORed with _DEFAULT. _SELF tells host that this device self-powered, while _RWU tells host that device supports Remote Wakeup. Definitions these options provided usbdefs_std_dsc.h. USB_EP_DSC endpoint descriptor form similar first parameters specify length this endpoint descriptor descriptor type. next parameter identifies endpoint. takes format: _EP<##>_<dir> where endpoint number direction transfer. value either 'OUT' 'IN'. definitions provided usbdefs_std_dsc.h. next parameter identifies type endpoint. Available options _BULK, _INT, _ISO _CTRL (for Bulk, Interrupt, Isochronous Control endpoints, respectively). _CTRL typically used because default control transfer endpoint defined descriptors. When _ISO used, additional options ORed with example: _ISO |_AD |_FE describes endpoint isochronous pipe with adaptive feedback attributes. usbdefs_std_dsc.h specification details. final parameters define maximum size endpoint polling interval. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board Descriptor String Rather than appearing simple string text, descriptor formatted particular data structure. string descriptor array takes format: struct{byte bLength;byte bDscType;word string[size];}sdxxx={ sizeof(sdxxx),DSC_STR,<text>}; This structure provides means compiler calculate length string descriptor sdxxx, where string index number. first bytes descriptor descriptor length type. remaining <text> string texts which must Unicode format. This achieved declaring each character word type. whole text string declared word array with number characters equals <size>; which must calculated manually counting characters then entered into array declaration. example, string "USB", then string descriptor should (using index 02): struct{byte bLength;byte bDscType;word string[3];}sd002={ project have multiple strings. firmware supports management multiple strings through look-up table, which defined const unsigned char *rom above example strings (sd000, sd001 sd002). Strings removed added needed. strings managed look-up table USB_SD_Ptr; index string must match index position array, (&sd000 must position USB_SD_Ptr[0], on). look-up table USB_SD_Ptr used USBStdGetDscHandler function usb9.c. sd000 specialized string descriptor. defines language code, which usually English (0x0409). 4.3.1.2.2 Customizing USBDCS.H header file usbdsc.h, variables each descriptor components named with following conventions: USB_CFG_DSC types named cdxx, where configuration number. This number should match actual index value configuration. USB_INTF_DSC types named i<yy>a<zz>, where interface number alternate interface number. USB_EP_DSC types named ep<##><d>_i<yy>a<zz>, where endpoint number direction transfer. interface name should also listed suffix identify which interface endpoint belongs Example shows structure usbdsc.h configuration descriptor. This device configuration with interfaces: interface with endpoints out), interface with endpoint (in). hierarchy descriptors shown here follows specification requirement. endpoints belonging interface should listed immediately after that interface. EXAMPLE 4-1: DEFINING CONFIGURATION USBDSC.H #define CFG01 struct USB_CFG_DSC cd01; USB_INTF_DSC i00a00; USB_EP_DSC ep01o_i00a00; USB_EP_DSC ep01i_i00a00; USB_INTF_DSC i01a00; USB_EP_DSC ep02i_i01a00; cfg01 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide 4.3.1.2.3 Adding Configurations device have more than configuration descriptors (e.g., CFG02, CFG03, etc.). another configuration descriptor, implement structures, similar CFG01, both usbdsc.c usbdsc.h. These will named CFG02 CFG03, on). Once this done, configuration descriptor name (cfg02, cfg03) look-up table USB_CD_Ptr, same method used managing descriptor strings. USB_CD_Ptr[0] dummy place holder configuration unconfigured state defined specification. configuration handler USBStdSetCfgHandler must also modified support additional configurations. 4.3.2 System Directory project system directory contains many core function files. structure shown Figure 4-5. FIGURE 4-4: DIRECTORY TREE STRUCTURE FRAMEWORK addition memory manager usbmmap.c, files discussed this section located following folders folder: usb9: usb9.c usb9.h usbctrltrf: usbctrltrf.c usbctrltrf.h usbdrv: usbdrv.c usbdrv.h usbdefs: standard definition files usbdefs_ep0_buff.h usbdefs_std_dsc.h. USBMMAP.C 4.3.2.1 This file memory manager; serves compile-time memory allocator endpoints. uses compile time options passed from usbcfg.h instantiate endpoints endpoint buffers. Endpoints defined using endpoint number direction transfer. simplicity, usbmmap.c only uses endpoint number register allocation scheme. This means usbcfg.h states that MAX_EP_NUMBER number then four BDTs will instantiated: each endpoint0 endpoint0 out, which must always instantiated control transfer default, each sets endpoint1 endpoint1 out. naming convention instantiating ep<#>B<d> where endpoint number, direction transfer, which could either: <o>. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board memory manager uses MAX_EP_NUMBER, defined usbcfg.h, define endpoints instantiated. This represents highest endpoint number allocated, many endpoints used. Since BDTs endpoints have hardware-assigned addresses Bank setting this value high lead inefficient data RAM. example, application uses only endpoints EP4, then MAX_EP_NUMBER in-between endpoint BDTs this example (EP1, EP3) unused, bytes memory associated with them wasted. (This assumes Ping-Pong Buffer mode which assigns bytes each BDT, endpoints each endpoint.) does make much sense skip endpoints, final decision lies with user. instantiated endpoint name then used usbcfg.h mapping endpoint function. example, assume device class "foo", which uses endpoint, each being bytes. Example 4-2, have chosen this class endpoint (The names arbitrary anything other than FOO_??????). abstraction, code written devices this class should abstract definitions such FOO_BD_OUT, FOO_BD_IN ep1Bo ep1Bi. Note that endpoint size defined usbcfg.h again used usbmmap.c. This shows that relationship between files tightly related. EXAMPLE 4-2: #define #define #define #define #define DEFINING ENDPOINTS CLASS 0x00 UEP1 ep1Bo ep1Bi FOO_INTF_ID FOO_UEP FOO_BD_OUT FOO_BD_IN FOO_EP_SIZE endpoint buffer each function must located dual-port area (0x400 0x7FF) come after BDTs have been instantiated. example declaration volatile unsigned char[FOO_EP_SIZE] data; volatile keyword tells compiler perform code optimization this variable because content could modified hardware. keyword tells compiler that this variable located Access area (0x000 0x05F). variable globally accessible other files, prototype should also listed header file usbmmap.h with extern keyword, such extern volatile unsigned char[FOO_EP_SIZE] data; 4.3.2.2 USBDRV.C This file provides low-level services, handles hardware interrupts. This section describes functions which relevant user details. 4.3.2.2.1 USBCheckBusStatus Function This function should called once main loop. When sense used detect attachment detachment cable, this routine enables disables module accordingly. This helps increase power efficiency system. sense used, #define USE_USB_BUS_SENSE_IO statement usbcfg.h should commented out. This causes USBCheckBusStatus() enable module after device reset regardless attachment cable. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide 4.3.2.2.2 USBDriverService Function This functions polls hardware interrupt flags registers check event occurred, services event. also clears transaction completion flag, TRNIF, which after each transaction completion. Issues occur when application tries send receive transactions more than four times without clearing TRNIF flag. This because 4-level hardware FIFO stack storing transaction completions only emptied level time clearing TRNIF. When more than four transactions received without TRNIF being cleared, more transactions processed. example this happen shown Example 4-4. This stops module from responding further host requests until more stack becomes available. More information regarding USTAT transaction FIFO found chapter PIC18F2455/2550/4455/4550 device data sheet. user's application code should clear TRNIF directly, call USBDriverService() instead, Example Example 4-5. Clearing TRNIF directly endpoint transaction occurs first will cause that transaction lost serviced library firmware. EXAMPLE 4-3: TYPICAL METHOD PERFORMING TRANSACTION LOOP (PSEUDO CODE) main() while(1) USBDriverService(); if(!mHIDTxIsBusy()) HIDTxReport(); }//end while }//end main EXAMPLE 4-4: INCORRECT METHOD PERFORMING MULTIPLE TRANSACTIONS LOOP (PSEUDO CODE) main() while(1) USBDriverService(); while(mHIDTxIsBusy()); HIDTxReport(); while(mHIDTxIsBusy()); HIDTxReport(); while(mHIDTxIsBusy()); HIDTxReport(); while(mHIDTxIsBusy()); HIDTxReport(); while(mHIDTxIsBusy()); HIDTxReport(); }//end while }//end main This will never turn false because USTAT FIFO full Unreachable code DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board EXAMPLE 4-5: CORRECT METHOD PERFORMING MULTIPLE TRANSACTIONS LOOP (PSEUDO CODE) main() while(1) USBDriverService(); while(mHIDTxIsBusy()); HIDTxReport(); USBDriverService(); while(mHIDTxIsBusy()); HIDTxReport(); USBDriverService(); while(mHIDTxIsBusy()); HIDTxReport(); USBDriverService(); while(mHIDTxIsBusy()); HIDTxReport(); USBDriverService(); while(mHIDTxIsBusy()); HIDTxReport(); USBDriverService(); //other application code }//end while }//end main 4.3.2.2.3 USBSuspend Function This routine first puts module into suspended mode enables activity interrupt. There also modifiable section where user insert code carry power-saving scheme. Options implementing power saving discussed Microchip application note AN950, "Power Management PIC18 Microcontrollers with nanoWatt Technology" (DS00950). Before putting device sleep, wakeup source must enabled first. activity interrupt wakeup source, ACTVIE register. Note that main interrupt PIE2 register must also enabled, shown Example 4-6. EXAMPLE 4-6: PIR2bits.USBIF PIE2bits.USBIE Sleep(); PIR2bits.USBIF PIE2bits.USBIE ENABLING SUSPEND Make sure flag cleared wakeup source Goto sleep Clear flag Disable interrupt 4.3.2.2.4 USBWakeFromSuspend routine called when activity interrupt set. disables activity interrupt re-enable module. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide 4.3.2.2.5 USBRemoteWakeup Function application supports Remote Wakeup function, calling this routine sends resume signal host. should called when external stimulus other than causes device become active. Example shows sample code that would reside USBSuspend() function which would enable both external stimulus wakeup sources, call USBRemoteWakup() function wakeup source USB. EXAMPLE 4-7: ENABLING REMOTE WAKEUP Make sure flag cleared Make sure flag cleared wakeup source port change wakeup source PIR2bits.USBIF INTCONbits.RBIF PIE2bits.USBIE INTCONbits.RBIE Sleep(); if(INTCONbits.RBIF USBRemoteWakeup(); PIR2bits.USBIF PIE2bits.USBIE INTCONbits.RBIF INTCONbits.RBIE Goto sleep Check wakeup source port change interrupt yes, attempt Remote Wakeup Clear flag Disable interrupt Clear flag Disable port change interrupt 4.3.2.3 USBCTRLTRF.C This file manages control transfer, provides services classes that need handle requests (USB Chapter HID, CDC, etc.). Since control transfer service shared among many classes most transfers expand over multiple transactions, important keep track which class owns current control transfer session. This done Microchip (MUID). When MUID equal MUID_NULL, means classes capable handling request. handler usb9.c knows service request, current control transfer session variable updated equal MUID_USB9. Similarly request received, then MUID would MUID_HID. definitions MUID defined usbcfg.h only project-specific. This means different projects could have different sets MUIDs. user manage usage assignment MUID each project usbcfg.h. Each control transfer three stages: Setup, Data Status. state machine handling different control transfer stages Microchip firmware illustrated Figure 4-5. There three different states: WAIT_SETUP, CTRL_TRF_TX CTRL_TRF_RX. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board FIGURE 4-5: CONTROL TRANSFER STATE MACHINE Setup Token (Device Host) Setup Token (Host Device) Token Token CTRL_TRF_TX WAIT_SETUP CTRL_TRF_RX Token Token USBCtrlEPService() called from usbdrv.c. only services transactions that come through endpoint checks different transaction type call appropriate handlers (Endpoint SETUP, Endpoint Endpoint IN). transfer stage SETUP, then USBCtrlTrfSetupHandler() called service setup packet. Each control transfer setup packet always bytes long. There three steps servicing setup packet: routine initializes control transfer state machine. then calls each class specific request handlers attempt find handlers know service request. Once request handlers have chance analyze setup packet, function USBCtrlEPServiceComplete() checks transfer direction data stage determine prepare endpoint USBCtrlEPServiceComplete() wraps remaining tasks servicing setup packet. main task endpoint controls appropriately given situation. There three possible outcomes: Endpoint stalled request cannot serviced. Endpoint transferring data host during data stage. Endpoint receiving data from host during data stage. data stage expanded over multiple transactions. important keep track data source, data destination, data count data type. These tracked updated using four dedicated variables: pSrc pDst wCount memory type flag usb_stat.ctrl_trf_mem, which have value _ROM _RAM. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide When writing request handler send control transfer data from peripheral device host, make sure following: data source: location: pSrc.bRam <RAM buffer location>; location: pSrc.bRom <program memory location>; memory source type: usb_stat.ctrl_trf_mem <_ROM _RAM>; size data transfer: wCount._word <size data transfer>; data destination address handled automatically usbctrltrf.c; destination CtrlTrfData buffer space defined usbmmap.c When writing request handler receive control transfer data from host over multiple transactions, make sure following: data destination: pDst.bRam <RAM buffer location> (Note that memory destination type always _RAM) Initialize receive counter, wCount._word, zero data source address handled automatically usbctrltrf.c; destination CtrlTrfData buffer space defined usbmmap.c Once status stage complete, control transfer session owner (determined MUID value) process received data. data destination defined setup stage, length received data stored wCount._word. 4.3.2.4 USB9.C This file handles standard requests defined Chapter specification, handles enumeration process. function interest this file USBStdSetCfgHandler(), which users must modify match application's configuration setup behavior. 4.3.3 Compile Time Validation rules check correctness variables. enable compile time validation, following line your project files: #include This file validates value EP0_BUFF_SIZE, which must legal buffer size bytes). Additional validation rules added users, required. DS51526A-page 2004 Microchip Technology Inc. PICDEMFS USER'S GUIDE Chapter Reconfiguring PICDEMFS Hardware HIGHLIGHTS This chapter covers following: Configuring Demonstration Board Options Restoring PICDEMFS Firmware CONFIGURING DEMONSTRATION BOARD OPTIONS PICDEM board configured enable disable various hardware features. total jumper locations controlled various places around board. shipped from factory, locations bridged circuit traces, features enabled. change this, user will need traces, install pins block jumper. Afterwards, features enabled disabled easily installing removing jumper. some instances, single function (such digital temperature sensor) connected rest board through more than jumper. This allows selective tailoring controller's ports application that user develop. Specific cases discussed following sections. functions jumpers listed Table 5-1; their locations shown Figure 5-1. TABLE 5-1: Number JUMPER DESCRIPTION Type 2-way Bridge Bridge Bridge Bridge Bridge Bridge Bridge Bridge Bridge Bridge Bridge Bridge 2-way (USB power LED) Port Configuration Function Selects user-controlled Reset (S1) microcontroller disable external emulation Status bank through USART Receive (microcontroller's perspective) USART Flow Control (RTS) USART Transmit (microcontroller's perspective) USART Flow Control (CTS) (User-defined switch (User-defined switch (potentiometer) (temperature sensor) JP10 JP11 JP12 JP13 Board ID(s) JP14, JP15, JP16 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide FIGURE 5-1: JUMPER LOCATIONS (TOP) TRACE LOCATIONS (BOTTOM) DEMONSTRATION BOARD 5.2.1 Serial Port Configuration RS-232 serial port demonstration board incorporates hardware flow control with applications that require these control signals.This makes port useful developing wide range serial-to-USB translators. those applications that require hardware flow control, software flow control instead, hardware flow control feature selectively disabled cutting traces JP6. Note that signal self-power sense signal share single controller port (RA2). These functions cannot used concurrently. output signal from microcontroller, while self-power sense signal input signal. port must configured either input output each mode. provided explicitly disable signal. DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board 5.2.2 Disabling Temperature Sensor TC77 temperature sensor, each three lines that uses communicate with controller bridged with separate jumper. Removing three jumpers (JP10, JP11 JP12) disables sensor's function, makes three controller ports available user. 5.2.3 ICSP/ICD Configuration Using MPLAB MPLAB users reprogram board's microcontroller using In-Circuit Serial Programming(ICSP), debug firmware code using In-Circuit Debugger. RJ-11 receptacle (J3), also known ICSP/ICD connector, standard MPLAB interface found most Microchip development boards. Most PIC18 microcontroller only have legacy ICSP/ICD port, which shares pins RB7. When used, legacy port prevents applications from using these pins normal ports. 44-pin TQFP version PIC18F4550 only variant full-speed family devices have second ICSP/ICD port pins used I/O. This dedicated port allows utilized user's application. PICDEM board configured work with either legacy dedicated port using jumpers JP14 through JP16. shipped, demonstration board hardware-configured legacy port. change this, user must traces indicated Figure (item 14), install pins jumpers. When installed, connector configured jumpers shown Table 5-2. addition setting jumpers, ICPRT configuration CONFIG4L must also properly set. enable dedicated ICSP/ICD port, ICPRT must When board configured dedicated ICSP/ICD port, reset switch will longer function. ICRST acts only active-high reset port, which works when MPLAB sends High-Voltage programming signal, (VIHH). MCLR acts both active-low active-high reset ports. Thus, reset switch only works when connected MCLR pin. Additional information regarding dedicated ICSP/ICD port found "Special Features" section device data sheet (DS39632). TABLE 5-2: JUMPER CONFIGURATION ICSP/ICD CONNECTOR JP14 Pins Pins JP15 Pins Pins Pins Pins Connector Configuration Legacy (CHP_MCLR/RB7/RB6) Dedicated Port (ICRST/ICPGD/ICPGC) Note JP14 through JP16, location closest microcontroller. Before using connector programming debugging, verify that three jumpers correctly. Failure result programming debugger failure. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide 5.2.4 Adding In-Circuit Emulation Capability addition on-board PIC18F4550 microcontroller, PICDEM demonstration board also configured work with hardware emulators such MPLAB 2000 MPLAB 4000. this, user must install 44-pin riser area designated board. This comprised four 11-pin pads arranged square around microcontroller. device adapter (Microchip part number DVA18PQ440) will also required either MPLAB devices. Before using external emulator, users must also configure board disable existing controller. This done installing configuring jumper JP1. default configuration with upper pins connected, assigns device reset control With lower pins connected, grounds MCLR PIC18F4550, holding permanent reset. this state, external controller emulator connected riser will control demonstration board. RESTORING PICDEM FIRMWARE shipped from factory, microcontroller PICDEM board pre-programmed with firmware required interact with Demo Tool application. This provides code that makes interactive Demo mode possible, enables communication establish Bootload mode. users develop their applications, likely that controller will re-programmed with firmware. original firmware replaced, status LEDs other interactive features board longer work previously described. even possible that connectivity become disabled. those users developing bootloader applications, possible that change device configuration with firmware loaded through bootloader render demonstration board inoperable. either case, will necessary reprogram board using in-circuit programmer, such MPLAB Should ever become necessary return board original state, will necessary restore original firmware. necessary files have been installed host with rest PICDEM software, directory MCHPFSUSB\fw\_factory_hex\. reprogram microcontroller directly connector with original firmware, file picdemfsusb.hex. Users should follow procedure appropriate their device programmer development environment. DS51526A-page 2004 Microchip Technology Inc. PICDEMFS USER'S GUIDE Chapter Troubleshooting HIGHLIGHTS This chapter discusses following: Common issues with PICDEM demonstration board solve them COMMON PROBLEMS Power Normally, PICDEM board behaves default bus-powered device. connected functioning port, board will power will light. this does happen: Verify that port host system actually working plugging device that known good into port Verify that cable working substituting known functional cable power supply connected board, will switch Self Power mode automatically; will lit, will light instead. this does happen: Verify that power supply plugged wall outlet power. battery connection used, verify that correct polarity used. Check that voltage available VDC) power supply's plug. power supply being used, check appropriate voltage VDC). Check that regulated voltage VDC) available. appropriate Power lit, system does recognize board Check cable proper connections board computer. necessary, verify cable swapping another cable that known good. Demo Tool software running, press release S1to reset board. Windows Device Manager (accessed through System applet Control Panel), "Scan Hardware Changes" function attempt force system detect board. possible that only firmware programmed into microcontroller Bootload firmware. this case, enter Bootload mode pressing holding while pressing releasing Bootload mode does work, possible that firmware become corrupted. this case, will necessary reprogram microcontroller with original firmware through external in-circuit programmer. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide board functioning, stopped communicating with Demo Tool. Demo mode, press release then re-select board from drop down menu click "Connect". Bootload mode, press hold while resetting board (pressing releasing S1), then re-select board from drop down menu. After switching from Demo mode Bootload mode Demo Tool, board available selection dropdown list. demonstration board default firmware behaves separate devices. Invoking Bootloader firmware requires special hardware signal, generated holding while resetting board (pressing releasing S1). Similarly, board will available automatically when switching from Bootload Demo mode. this case, should only necessary reset board (press release S1). running Bootload mode first time, host system tries repeat driver installation process. Because demo bootloader firmware essentially separate pieces code with individual Product IDs, host system will each separate device. Each device will require driver installed separately Allow Windows Install Wizard same .inf file used original driver installation. DS51526A-page 2004 Microchip Technology Inc. PICDEMFS USER'S GUIDE Appendix PICDEMFS Board Technical Information HIGHLIGHTS This chapter will cover following topics: PICDEM Block Diagram PICDEM Board Schematics BLOCK DIAGRAM FIGURE A-1: PICDEM DEMONSTRATION BOARD FUNCTIONAL BLOCK DIAGRAM Oscillator Reset Switch (S1) Connector (J1) RS232 Port (P1, User Switches (S2, PIC18F4550 (U2) Connector (J3) Potentiometer (R20) Expansion PICtailHeaders (J6, Temperature Sensor (U4) Status LEDs (D1-D4) (Bus Power) (optional) On-Board Power Regulation Power LEDs (D7, 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide PICDEM BOARD SCHEMATICS BOARD SCHEMATIC, PART (MICROCONTROLLER, VOLTAGE REGULATION ASSOCIATED PARTS) FIGURE A-2: DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board FIGURE A-3: BOARD SCHEMATIC, PART (USART, INTERFACE, THERMAL SENSOR STATUS LEDS 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide FIGURE A-4: BOARD SCHEMATIC, PART (CONFIGURATION JUMPERS, PICkit HEADERS OPTIONAL MPLAB HEADER) PICtail Interface DS51526A-page 2004 Microchip Technology Inc. Introduction PICDEMFS Board TABLE A-1: CHP_MCLR ICPGC, ICPGD, ICRST ICD_RB6, ICD_RB7 MCLR OSC1, OSC2 RESET USB_D+, USB_DUSB_ATTACH USB_SLEEP VUSB VBUS SIGNALS USED PICDEM SCHEMATIC Function Hardware Master Clear signal (direct connection MCLR microcontroller) Dedicated port clock, data chip reset signals Legacy port signals (PGC PGD) Hardware Master Clear signal External oscillator input microcontroller Generic chip reset signal (routable MCLR ICRST) microcontroller Port Differential signals attachment signal generated power supply Optional suspend signal from external transceiver Regulated 3.3V VUSB supplied microcontroller's on-chip regulator power voltage supplied from cable Signal Name TABLE A-2: RS-232 RS-232 INTERFACE PINOUT PIC18F4550 RC6/TX RC7/RX Function (Received Data, Perspective) (Transmit Data, Perspective) (Request Send) (Clear Send) TABLE A-3: SDI/RB0 SCK/RB1 PERIPHERAL INPUT OUTPUT ASSIGNMENTS Function Output Output Output Output (potentiometer) Input TC77 (SPI Data Input) TC77 (SPI Clock Output) TC77 (Chip Select Output) PIC18F4550 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide NOTES: DS51526A-page 2004 Microchip Technology Inc. PICDEMFS USER'S GUIDE Appendix PICDEMFS Starter HIGHLIGHTS This chapter summarizes contents PICDEM Starter WHAT'S PICDEM Starter includes following software tools support documentation. PICDEM Software Package entire utility contained self-extracting installer file MCHPFSUSB_Setup.exe. Executing this file will install Demo Tool application drivers described Chapter "Using Demo Tool Application", plus documentation described below. will also install demonstration tutorial applications several classes. License Agreement This full text Microchip Software licensing agreement that appears beginning software installation process. provided Adobe® Acrobat® format. Documentation This folder contains relevant documentation PIC18F2455/2550/4455/4550 family microcontrollers PICDEM demonstration board. Documents distributed among these folders: Applications Notes: most current Microchip application notes PIC18F2455/2550/4455/4550 family. Data Sheets: latest revision PIC18F2455/2550/4455/4550 device data sheet Errata: latest silicon errata data sheet clarifications PIC18F2455/2550/4455/4550 family Users Guide: This document, provided Adobe Acrobat format. Tools This folder contains links latest versions Microchip's MPLAB compiler. Both available download Microchip site, www.microchip.com. 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide NOTES: DS51526A-page 2004 Microchip Technology Inc. PICDEMFS USER'S GUIDE Index Autofiles Directory Expansion Headers. Bootload Mode Using. Bootloader Writing Application Code Considerations Using Program Memory Hardware Configuration Jumper Settings Host Computer Requirements. Connector Configuring. Interface Riser. Internet Address. Clock Configuration. Code Examples Defining Configuration usbdsc.h Defining Endpoints Class Enabling Remote Wakeup. Performing Transaction Loop Correct Incorrect. Typical Reset Vector Insert Linker Script Assembly Compile Time Validation Configuration Jumpers ICD.9, Locations Connectors Power. Serial (DB9F) Control Transfer State Machine Customer Notification Service. Customer Support Customizing Firmware Files Adding Configurations usbcfg.h. usbctrltrf.c usbdsc.c. usbdsc.h. usbmmap.c Jumper Descriptions Locations LEDs Power. Status. Microchip Internet Site Microchip Firmware Framework Configuring MPLAB for, Directory Structure Logical Structure Runtime Relationships. Oscillator PIC18F4550 PICDEM Board Block Diagram. Jumper Locations. Schematics 54-56 Signals Schematic (table) PICDEM Software Package PICDEM Starter Contents. PICtail Header. Potentiometer. Push Buttons Reset. User-defined Demo Mode Demo Tool Software Bootload Mode. Demo Tool Documentation Conventions Layout 2004 Microchip Technology Inc. DS51526A-page PICDEMFS User's Guide Reading, Recommended. Readme. RS-232 Port Configuration. USART Interface usb9.c usbbdrv.c usbcfg.h USBCheckBusStatus() usbctrltrf.c. USBDriverService(). usbdsc.c usbdsc.h usbmmap.c USBRemoteWakeup(). USBSuspend(). USBWakeFromSuspend() System Directory Thermal Sensor. Disabling Warranty Registration. Address DS51526A-page 2004 Microchip Technology Inc. Index NOTES: 2004 Microchip Technology Inc. DS51526A-page WORLDWIDE SALES SERVICE AMERICAS Corporate Office 2355 West Chandler Blvd. Chandler, 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://support.microchip.com Address: www.microchip.com Atlanta Alpharetta, Tel: 770-640-0034 Fax: 770-640-0307 Boston Westford, Tel: 978-692-3848 Fax: 978-692-3821 Chicago Itasca, Tel: 630-285-0071 Fax: 630-285-0075 Dallas Addison, Tel: 972-818-7423 Fax: 972-818-2924 Detroit Farmington Hills, Tel: 248-538-2250 Fax: 248-538-2260 Kokomo Kokomo, Tel: 765-864-8360 Fax: 765-864-8387 Angeles Mission Viejo, Tel: 949-462-9523 Fax: 949-462-9608 Jose Mountain View, Tel: 650-215-1444 Fax: 650-961-0286 Toronto Mississauga, Ontario, Canada Tel: 905-673-0699 Fax: 905-673-6509 ASIA/PACIFIC Australia Sydney Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 China Beijing Tel: 86-10-8528-2100 Fax: 86-10-8528-2104 China Chengdu Tel: 86-28-8676-6200 Fax: 86-28-8676-6599 China Fuzhou Tel: 86-591-8750-3506 Fax: 86-591-8750-3521 China Hong Kong Tel: 852-2401-1200 Fax: 852-2401-3431 China Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 China Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 China Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 China Shunde Tel: 86-757-2839-5507 Fax: 86-757-2839-5571 China Qingdao Tel: 86-532-502-7355 Fax: 86-532-502-7205 ASIA/PACIFIC India Bangalore Tel: 91-80-2229-0061 Fax: 91-80-2229-0062 India Delhi Tel: 91-11-5160-8631 Fax: 91-11-5160-8632 Japan Kanagawa Tel: 81-45-471- 6166 Fax: 81-45-471-6122 Korea Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 82-2-558-5934 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 Taiwan Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 Taiwan Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 Taiwan Hsinchu Tel: 886-3-572-9526 Fax: 886-3-572-6459 EUROPE Austria Weis Tel: 43-7242-2244-399 Fax: 43-7242-2244-393 Denmark Ballerup Tel: 45-4450-2828 Fax: 45-4485-2829 France Massy Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Germany Ismaning Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 Italy Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Netherlands Drunen Tel: 31-416-690399 Fax: 31-416-690340 England Berkshire Tel: 44-118-921-5869 Fax: 44-118-921-5820 10/20/04 DS51526A-page 2004 Microchip Technology Inc. Other recent searchesUWR-96 - UWR-96 UWR-96 Datasheet 100-D48A - 100-D48A 100-D48A Datasheet MA700 - MA700 MA700 Datasheet MA700A - MA700A MA700A Datasheet LM2453 - LM2453 LM2453 Datasheet GP1S96 - GP1S96 GP1S96 Datasheet FW802BF - FW802BF FW802BF Datasheet A1174 - A1174 A1174 Datasheet
Privacy Policy | Disclaimer |