Control I/O ports on AN2131QC

Question: How do I control the AN2131's I/O ports for faster transfer of data in/out of USB controller?



The EZ-USB AN21XX family implements its IO ports using memory mapped registers. This is in contrast to a standard 8051, which uses SFR bits for input/output. The IO ports of the EZ-USB parts are not bit addressable. (Please note that the CY7C646XX FX parts do allow SFR mapping of the port bits.)

The port I/O pins are either configured as output or input. In order to write to it you need to write to the OUTx (where x = A, B or C) register and if configured as an input you need to read the state of the I/O pins using the PINSx register.

Please see the TRM, chapter 4 on how to configure GPIO Port pins for I/O functionality. To set a port, one would need to read the entire byte of the port (say Port A), logical OR with a particular mask pattern, then write back the resultant byte to that port again. This is the only way to capture data and transfer them in/out the external world.