advertisement
3.
My First USB 2.0 Transfer using FX2LP
3.1
3.2
3.3
Introduction
This chapter introduces the FX2LP board and its tools by walking through a simple USB example called “bulkloop.” USB peripherals transfer data over logical entities called “endpoints.” A common endpoint type is called “bulk.” The PC schedules bulk transfers on a time-available basis. Bulk transfers use feedback (acknowledge packets) for flow control and employ error checking with a retry mechanism to guarantee the accurate delivery of USB data packets.
Application Summary
The FX2LP bulkloop firmware continuously checks for USB OUT packets sent by a PC. When they are received, the firmware copies the received data into an IN buffer for transmission back to the PC.
On the PC side, you use the USB Control Center application to send data to FX2LP using OUT transfers and then to launch IN transfers to read back the data. You can confirm that the received data is the same data as that sent by the PC.
The bulkloop example utilizes an FX2LP feature called “double buffering”, which allows up to two packets to be stored for later transmission back to the PC.
Procedure
1. Locate the USB Control Center folder and navigate to its bin directory
(<Installed_directory>\<version>\Windows Applications\Application Source files\c_sharp\controlcenter\bin) . Double click on the CyControl.exe
file in either the Debug or
Release folder.
2. If the FX2LP DVK is not plugged in, confirm its settings in
Prepare the FX2LP Development Kit on page 11
and attach it to the PC using the USB receptacle and supplied cable. If the driver is
correctly installed, you should see the FX2LP board appear as shown in Figure 3-1
. If you do not, make sure the EEPROM SELECT switch is in the “down” position and reconnect. Deactivating the onboard EEPROM enables FX2LP to be used as a USB code-loading device.
EZ-USB
®
Development Kit User Guide, Doc. # 001-66390 Rev. *G 13
Figure 3-1. FX2LP DVK Recognized by USB Control Center
My First USB 2.0 Transfer using FX2LP
3. Now you are ready to load the FX2LP firmware bulkloop.hex
into the board. Click on the
Cypress device entry to highlight it, and then choose Program > FX2 > RAM
). In the
Firmware folder, open the Bulkloop folder and double-click the bulkloop.hex
file. After the code loads, the FX2LP DVK disconnects from USB and reconnects as the device created by the loaded firmware bulkloop.hex
. This is Cypress ReNumeration™ in action – FX2LP has enumerated twice, first as a code loader and then as the bulkloop device created by the loaded firmware.
Figure 3-2. Downloading hex file into FX2LP's RAM
The LED D5 should blink eight times per second for a high-speed USB attachment and once per second for a full-speed attachment. For a high-speed USB attachment, you will see the LED blink slowly for a second or so and then start blinking quickly. This is because a USB device initially attaches at full speed and then negotiates the high-speed connection with the host. This is one of
the many firmware details handled by the Cypress USB framework described in FX2LP Code
Development Using the EZ-USB Framework chapter on page 39
.
The 7-segment readout should light up with the number 0, indicating the number of FX2LP packets ready to be transferred back to the host. None have been received for loopback yet.
Note: Before you load a .hex file into the FX2LP DVK, you must press the Reset button (lower left corner) to reset the FX2LP and thereby re-enable the FX2LP bootloader.
EZ-USB
®
Development Kit User Guide, Doc. # 001-66390 Rev. *G 14
My First USB 2.0 Transfer using FX2LP
4. Expand the Cypress device entry to reveal the device’s bulk endpoints EP2-OUT and EP6-IN
(
Figure 3-3. Bulkloop Example Device Internals
5. Select the Data Transfers tab. Click on the “Bulk out endpoint (0x02)” entry in the left-hand panel, and notice that the Transfer Data button appears as Transfer Data-OUT . Click this button, and observe the following (
): a. A total of 512 bytes with zero default values transfer from the PC to the FX2LP board.
b. LED D3 flickers to indicate the OUT transfer. c. The 7-segment readout increments to 1, indicating that one packet has been received over
EP2-OUT and loaded into the FX2LP EP6 IN endpoint FIFO, ready for transfer to the PC.
Figure 3-4. Successful Bulk OUT Transfer
Click the Transfer Data-OUT button again. The PC dispatches a second packet to FX2LP, and the 7-segment readout increments to 2, indicating that two FX2LP packets are waiting to be sent to the PC.
EZ-USB
®
Development Kit User Guide, Doc. # 001-66390 Rev. *G 15
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 8 Development Kit
- 8 Kit Contents
- 8 1.2.1 Hardware
- 9 1.2.2 Software
- 10 1.2.3 Other Tools
- 11 Documentation Conventions
- 12 Prepare the FX2LP Development Kit
- 13 Kit Software Installation
- 13 Install Hardware
- 14 Introduction
- 14 Application Summary
- 14 Procedure
- 17 Summary
- 18 Introduction
- 18 Schematic Summary
- 19 Jumpers
- 20 EEPROM Select and Enable Switches SW1 and SW
- 22 Interface Connectors
- 26 ATA Connector P
- 26 U2 – 22v10 Gate Array Logic
- 27 Memory Maps
- 28 I2C Expanders
- 29 4.10 Indicators – Power and Breakpoint
- 29 4.11 General-Purpose Indicators
- 32 Documentation
- 33 Drivers
- 33 Firmware
- 33 5.4.1 Bulksrc
- 33 5.4.2 CyStreamer
- 33 5.4.3 Dev_io
- 33 5.4.4 Bulkloop Firmware
- 33 5.4.5 EP_Interrupts