Top Banner

Click here to load reader

Usb Multi Role Device Design By Example

Jan 28, 2015

ReportDownload

Business

allankliu

USB OTG development from Cypress.

  • 1. USB Multi-Role Device Design By Example John Hyde

2. USB Multi-Role Device Design By ExampleJohn Hyde (Commissioned by Cypress Semiconductor) 3. USB Multi-Role Device Design By ExampleJohn Hyde Foreword by Brian BookerWe were pleased to get John Hyde to write this book on Cypress Semiconductors behalf. It should be considered a supplement to his USB Design By Example in the same way that the OTG Supplement complements the USB 2.0 Specification. Only the new elements of multi-role device design are covered since these build on the established base defined by the USB specification.Cypress Semiconductor supports all facets of USB design and has products covering the breadth and depth of possible USB solutions. The two products described in this book, the CY7C67200 EZ-OTG Host/Peripheral Controller and the CY7C67300 EZ-Host Host/Peripheral Controller will enable new designs particularly in the portable applications arena. This book, with the support of other Cypress documentation, should get your USB product idea rapidly into development and then into the prototype stages. We at Cypress Semiconductor are dedicated to supporting your design efforts through production and 24 hour support is available at www.cypress.com.iii 4. Acknowledgements: I would like to thank Cypress Semiconductor for providingme with an opportunity to write about these two remarkablecomponents. The EZ-Host and EZ-OTG include featuresthat enabled me to solve a much wider range of customerprojects. I particularly like the small size of the EZ-OTGsince it enables USB to be used in many more solutions. I could not have completed this book without the expert helpof Cypresss Systems Engineering Team in Boise. I mustparticularly thank Rick Pennington, DeVerl Stokes, RayAsbury, James Cahoon and Steven Connelly for their time,teaching and impressive development platform includingthree boards, Frameworks code and several designexamples. Additionally, Simon Nguyen provided a wealth ofinformation about the internal operation of the components,and his in-depth answers to all of my questions enabledbetter descriptions in the text.Several of Cypresssapplications engineers, especially Glenn Roberts, MattLeptich and Troy Gentry, provided valuable feedback duringthe review process and this also helped improve the qualityand accuracy of the book. I had a lot of fun writing this book and I trust that you willenjoy reading it. You will also have fun using these two newcomponents from Cypress Semiconductor to create new andexciting USB solutions.All Text and figures copyright 2003 by John Hyde iv 5. Table of ContentsTable of Contents ..........................................................................................................v List of Figures.............................................................................................................. vii Chapter 1: Expanding the USB Applications Range................................................... 1 Original USB Design Intent....................................................................................... 1 Host Role Responsibilities........................................................................................ 3 Ease of Use .............................................................................................................. 5 Dual Role Device Implementation ............................................................................ 6 Transforming into a host........................................................................................... 8 Chapter Summary .................................................................................................. 11 Chapter 2: Getting to know EZ-Host and EZ-OTG .................................................... 13 Hardware features .................................................................................................. 13 Central Processing Unit.......................................................................................... 14 Memory Expansion Capability ................................................................................ 15 Additional EZ-Host Capability................................................................................. 15 Integrated Timers ................................................................................................... 16 Power Management ............................................................................................... 16 USB Capabilities..................................................................................................... 17 Parallel IO ............................................................................................................... 18 Serial IO.................................................................................................................. 19 IO Summary ........................................................................................................... 19 Firmware Features ................................................................................................. 21 BIOS Operation ...................................................................................................... 22 BIOS Memory Management ................................................................................... 23 BIOS Idle Task ....................................................................................................... 25 BIOS Scan Operation ............................................................................................. 26 Other BIOS functions.............................................................................................. 28 Chapter Summary .................................................................................................. 28 Chapter 3: EZ-Host/EZ-OTG Development Environment......................................... 29 CY16 Firmware Architecture .................................................................................. 31 Frameworks Subsystem ......................................................................................... 33 Simple Example #1 - Hello World........................................................................... 33 Target System ........................................................................................................ 34 Simple Example #2 Using Scan Records............................................................ 38 Simple Example #3 Buttons and Lights Device .................................................. 39 Simple Example #4 BAL Host Program .............................................................. 44 Simple Example #5 Standalone BAL Device ...................................................... 46 Chapter Summary .................................................................................................. 46 Chapter 4: Developing a host application ................................................................. 47 Key Host Controller Concepts ................................................................................ 47 Frameworks Host Controller Implementation ......................................................... 50 Device Identification ............................................................................................... 55 Simple Example #6 Buttons and Lights Host ...................................................... 56v 6. Chapter Summary ...................................................................................................60 Chapter 5: Concurrent operation as a host and device.............................................61 Simple Example #7 Concurrent BAL Host and Device........................................63 Simple Example #8 Using Scan Records 2 .........................................................69 Smart USB Devices ................................................................................................71 Data Acquisition Example .......................................................................................73 Video Black Box Example.......................................................................................76 Chapter Summary ...................................................................................................77 Chapter 6: Designing a dual-role device ...................................................................79 New dual-role concepts ..........................................................................................80 Simple Example #9 - Dual-role Buttons and Lights Device ....................................80 Simple Example #10 Standalone Dual-role Buttons and Lights Device ..............89 OTG behind-the-scenes..........................................................................................92 Session Request Protocol.......................................................................................95 Chapter Summary ...................................................................................................97 Chapter 7: Using EZ-Host/EZ-OTG in coprocessor mode as a USB host controller 99 USB Host Controller Driver ...................................................................................104 Low-level Communications Driver ........................................................................106 Link Control Protocol.............................................................................................107 Root hub functionality............................................................................................108 Testing our host controller ....................................................................................108 Chapter Summary .................................................................................................111 vi 7. List of FiguresFigure 1-1. Standard USB terminology ....................................................................... 2 Figure 1-