TABLE OF CONTENTSTable 1. Current Types of USB . . . 1Table 2. μPSD USB Family (February 2004). 1IAP USB Demonstration Program . . . 5Table 3. USB Demonstration Program Revision History 5Hardware Design . . . 6Figure 1. USB Input/Output Design inside the μPSD32xxA 6Figure 2. Typical USB Connection Circuit for 5V (μPSD32xx) Systems. . . . 6Possible Frequencies for μPSD with Low-speed USB 7Table 4. μPSD32xx USB SFR Register Map. 7Software Design 8Table 5. List of Header Files . . . . . 8Table 6. List of C Source Files . . . . 8USB Communication Flow 8Figure 3. USB Host/Device Detailed Communication Flow View 9Endpoints Supported by μPSD32xx 9Table 7. Supported Endpoints . . . 10Data Structures and Data-flow . . 10Table 8. USB Demonstration Program Data Structures . 10USB Bus Level Interface . 10Bus Enumeration . 11Endpoint0 . 12Endpoint1 (LCD display mirror) . 12Table 9. Endpoint Packet Byte Function Assignment . 12USB Setup Packet Handling – Standard Device Requests . 12USB Requests in the USB Demonstration Program . . . . 13Table 10. Des criptor Type (the high byte of wvalue in the Get_Des criptor request) 13Table 11. Valid Types of Class Des criptor. . . 13Get_Des criptor Request . 13Table 12. Components of a Get_Des criptor Request . . 14Get_Report Request . . . . 14Table 13. Components of a Get_Report Request . . . . . 14SET_Report Request . . . . 14Table 14. Components of a SET_Report Request . . . . 15USB Des criptors . 15Figure 4. USB and HID Des criptor Structure 15GET_Des criptor Request Servicing Routine 16Des criptors 16Example of USB Des criptors for HID Class Devices 17Table 15. Device Des criptor . . . . . 18Table 16. Configuration Des criptor 19Table 17. Interface Des criptor . . . . 19Table 18. HID Des criptor . . 20Table 19. Endpoint Des criptor . . . . 20Table 20. Report Des criptor 21High Level Interface . . . . 22HID Level Interface . . . . . 22SUSPEND Mode and RESUME Mode Handling Mechanism 23USB Disconnect on Demand Feature . . . . 24Important Rules when Starting to Design USB Applications with μPSD32xxA . 25Differences between USB 1.1 Hosts and Some USB 2.0 High-speed Hosts 25Figure 5. Traffic on USB (μPSD32xxA connected to USB1.1 Host, or to an Intel 82801DBx Type USB2.0 Host) 25Figure 6. Traffic on USB (μPSD32xxA connected to an NEC 720100A Type USB 2.0 Host) . . . . 26USB Interrupt must have the Highest Priority Interrupt Level . 26Table 21. Des cription of the IP Bits 27Table 22. Des cription of the IPA Bits . 27Length of USB Interrupt Service Routine . 28Table 23. Oscillator Frequencies Suitable for Applications with USB . . . . . 28Figure 7. USB Demonstration Program USB Drivers Immunity versus Length of USB ISR (with respectto Oscillator Frequency)28Difference between Relative and Absolute Register Usage 28Table 24. Suggested Assignment of Register Banks . . 30USB may Generate Spurious Interrupts when the Device is Plugged in . . . 30μPSD USB IP sometimes Triggers an Interrupt but no Bit of UISTA is Set . 30μPSD USB IP Generates Interrupts with an Undocumented Flag. . . . . 30USB State Machine does not Clear the STALL0 Bit when a SETUP Packet is Received . . . . 30The Number of Data Bytes Received in a Data Packet can be Greater than Eight . . . 31C Source and Assembler Output can have Different Functionality . . . 31Question: So How Must I Write My Drivers? . 32Question: Must I Enable and Service End-of-Packet Interrupt Requests? . 32Question: Is the Length of USB ISR Limited? . . . . . 32Limits Set by the Specification: . . . 32Table 25. Examples of Limits set by USB Standards . . 32Known limits: . . . 33Conclusion: 33Question: My Device with μPSD is not Properly Detected by Windows . . . 33Figure 8. USB ISR Response Time . 33Figure 9. USB ISR Response Time - Detail . 34Problems with Windows98 and Multiple-function USB Devices 34Symptoms . 34Cause . . . . 34Conclusion . 34Status . . . . 34More Information 35Conclusion . . . 36References . . . 36APPENDIX A.USBISR 37APPENDIX B.OnTransmitEP1 39APPENDIX C.OnSetupPacket 40APPENDIX D.OnGetDes criptor . . . . . 41APPENDIX E.ReportDesc . . . 42APPENDIX F.DeviceDesc . . . 43APPENDIX G.Language, Manufacture and Product Strings . . . 45APPENDIX H.High Level Interface . . 47APPENDIX I. OnReportReceived . . . 48APPENDIX J.OnUSBSuspend 49APPENDIX K.ReConnectUSB 50APPENDIX L.Glossary 51Table 26. Terms and Abbreviations 51Revision History . . . 53