You are here

Reading GPIO inputs | Cypress Semiconductor

Support & Community

Reading GPIO inputs

Last Updated: June 19, 2011

Question:How to read GPIO inputs?

Response:The SYSIRQ pin provides a way for systems to request service from host software by using the USB Interrupt pipe on endpoint 1 (EP1). If the AT2LP has no pending interrupt data to return,USB interrupt pipe data requests are NAKed. If pending data is available, the AT2LP returns 16 bits of data. This data indicates whether AT2LP is operating in high-speed or full-speed, whether the AT2LP is reporting self-powered or bus-powered operation, and the states of any GPIO pins that are configured as inputs. GPIO pins can be individually set as inputs or outputs, with byte 0x09 of the configuration data. The state of any GPIO pin that is not set as an input is reported as 0 in the EP1 data.The host software has to read from EP1 data byte 1 and mask of bit 7 and 6. The lower bits 5:0 show GPIO data.

The following table gives the Interrupt Data Bitmap for the data returned on the interrupt pipe.             

                                                                EP1 Data Byte 1                                          EP1 Data Byte 0

ReservedReservedReservedReservedReservedReservedUSB High-SpeedVBUS PoweredReservedReservedGPIO[5]GPIO[4]GPIO[3]GPIO[2]GPIO[1]






Referenced Documents ::



Provide feedback on this article

Browse KB By Product

Browse KB by Type