76
EZ-USB Development Kit User Guide, Doc. # 001-66390 Rev. *D
EZ-USB Development Kit Firmware Examples
by a NYET, it first sends a PING token to see if the endpoint is ready (for example, if it has an empty
buffer). If a buffer is not available, the FX2LP returns a NAK handshake. PING-NAK transactions
continue to occur until an OUT buffer is available, at which time the FX2LP answers a PING with an
ACK handshake and the host sends the OUT data to the endpoint. EZ-USB implements PING-NAK
interrupt as EP0PING, EP1PING, and so on, one for each endpoint. The EPxPING interrupt is
asserted when the host PINGs an endpoint and the FX2LP responds with a NAK because the partic-
ular endpoint buffer memory is not available. The FX2LP firmware framework provides hooks for all
the interrupts that it implements. The example project uses ISR_Ep2pingnak and ISR_Ep4pingnak
interrupt service routines to handle EP2PING and EP4PING interrupts respectively.
void ISR_Ep2pingnak(void) interrupt 0
{
SYNCDELAY; // Re-arm endpoint 2
EP2BCL = 0x80;
EZUSB_IRQ_CLEAR(); // clear the EP2PING interrupt
NAKIRQ = bmEP2PING;
}
The ISR_Ep2pingnak discards the previous data that is stored in one of the buffers of Endpoint 2 by
re-arming the endpoint (that is, EP2BCL = 0x80). Therefore, EP2 can now receive the data that is
currently being sent by the host because there is space available in one of its buffers. It then clears
the interrupt by setting a particular bit in NAKIRQ because it has been serviced. The same operation
is carried to service the EP4PING interrupt in ISR_Ep4pingnak.
8.4.2
Building Firmware Example Code for EZ-USB RAM and EEPROM
Click on
Build
Target
button at the top right corner of the IDE. The total code bytes of the
pingnak
firmware example is less than the 4-k code limit Keil µVision2 IDE provided along with the kit. The
output of the
Build
Target
is
pingnak.hex
and
pingnak.iic
files.
8.4.3
Method to Download Firmware Image to EZ-USB Internal RAM and External
EEPROM
Refer to
Method to Download Firmware Image to EZ-USB Internal RAM Memory on page 69
and
Method to Download Firmware Image to External I2C EEPROM on page 69
and follow a similar pro-
cedure to download pingnak.hex to RAM memory or
pingnak.iic
to Large EEPROM using the
CyConsole or CyControlCenter. Both images are located at
<Installed_directory>\<Ver-
sion>\Firmware\pingnak
. After downloading, the firmware re-enumerates with the PC using its
internal VID/PID-0x04B4/0x1004.
8.4.4
Binding Cypress USB Driver for the Downloaded Firmware Image
The
pingnak
project uses vendor-class (0xFF) with VID/PID-0x04B4/1004. This example should
bind with the Cypress generic USB driver, cyusb.sys, and the driver information file,
cyusbfx1_fx2lp.inf,
which contains the relevant VID/PID of this example. Follow the procedure out-
lined in
Binding Cypress USB Driver to EZ-USB Development Board on page 45
to manually bind
the driver using Windows Hardware Wizard. If the binding process is performed for anyone of the
firmware example the process can be skipped for this example.
8.4.5
Testing the pingnak Firmware Functionality
Follow these steps to test the pingnak firmware:
1. After the board re-enumerates, use CyConsole to send 512 bytes from EP2 to EP6. The data
received should be the same as the data sent. 512 bytes of user-defined data can be sent from
the host to Endpoint 2 using CyConsole. For example, select Endpoint 2 OUT in the pipe window
Summary of Contents for CY3674
Page 18: ...18 EZ USB Development Kit User Guide Doc 001 66390 Rev D Getting Started...
Page 34: ...34 EZ USB Development Kit User Guide Doc 001 66390 Rev D Development Kit Contents...
Page 54: ...54 EZ USB Development Kit User Guide Doc 001 66390 Rev D Cypress USB Drivers for EZ USB Kits...
Page 110: ...110 EZ USB Development Kit User Guide Doc 001 66390 Rev D Resources...
Page 113: ...EZ USB Development Kit User Guide Doc 001 66390 Rev D 113 A 2 Board Layout...