1. Components
CYPRESS 68013A: Support USB 2.0 protocol, with enhanced 8051 single-chip microcomputer, clock frequency 48Mhz. Support serial communication.
2. Documentation
Cy7c68013.pdf |
68013 Peripherals Manual |
Cy7c68013_5.pdf |
68013 Peripherals Manual |
Cy3684_a_sch. Pdf |
68013A Peripheral circuit diagram |
FX2 techrefmanual.pdf |
EZUSB-FX2 Technical Manual |
Fx2_to_fx2lp.pdf |
The difference between FX2 and FX2LP |
Cyapi. Pdf |
CYAPI Manual Advanced Class Library |
Cyusb. Pdf |
CYUSB Manual Underlying API |
|
|
3. Development Environment
3.1 Keil C 7.0 Compiler
3.2 C + + Builder 6.0
3.3 VC + + 6.0
3.4 Eeprom burning writer
3.5 68013A Development Kit with Cypress CONSOLE, Cyusb. SYS, routines, etc.)
3.6 BUS Hound 5.0
4. Development Process
4.1 Hardware program writing
1) According to Cypress's example program to establish the engineering framework, generally by FW.C periph. C and a few header files that define the register.
2) FW.C is responsible for the device connection, re-enumeration, device initialization and other processes
3) PERIPH.C is responsible for responding to various interrupt events.
4) The Dscr.a51 file defines the various descriptors required for the USB device handshake
5) FX2REGS.H defines all the registers in the USB
6) FX2.H mainly defines the data structures of various level two interrupt vectors and descriptors.
7) compiled binary code with the same name as the project, with the extension hex.
8) The corresponding header file and class library are in the Lib and Inc folder in Keil C, and you need to set the path in the project settings.
4.2 Hardware program Burning
1) Because this product requires the binary code and hardware Pid/vid burned in the EEPROM, rather than using the Cypress recommended online download method, so the external use of 8K EEPROM. After power-up, 68013A loads the data and programs in the EEPROM to run in RAM.
2) Hex file is only 68013A 8051 of the program code, but also add pid/vid and other information to run correctly, Cypress in the development package provides HEX2BIN.EXE this tool, can be generated according to hex complete IIC file, the file will be burned to the EEPROM.
3) The following methods are used for HEX2BIN.EXE:
Copy the Xxx.hex file to the directory where HEX2BIN.EXE is located, open cmd, and enter it in the following format:
Hex2bix-i-o xxx.iic xxx.hex-f 0xc2-v 0x1234-p 0x1234
-I represents the output file, which is the IIc file
-O indicates the input file, which is the hex file
-F means the 68013A sends the Pid/vid, here is the C0, namely reads from the EEPROM.
-V represents the BCD code for VID, and the development phase uses 1234
-P indicates the BCD code of the PID, using 1234 in the development phase
4) The generated IIC files are burned to the EEPROM, the project uses the Shenzhen si Tai Jia Electronics Company's NSP General burner, this burner does not support IIC type, choose bin type can be substituted.
4.3 Identification of the drive
1) After connecting the EEPROM to the 68013A, connect the USB cable and power on. The computer prompts to find the new hardware and requires the driver to be installed.
2) Cypress provides a new driver Cyusb.sys for 68013A. This driver uses a new API, so the host computer is written in a completely different way from the old one. The definition of the underlying IOCTL control words is also completely different, see Cyapi.pdf and Cyusb.pdf.
3) Before installing the driver, you must first correctly edit the Cyusb.inf file according to Vid/pid, add your own Pid/vid code and device description in the file, when connecting the device, it will find the corresponding driver in the INF file according to Pid/vid on the hardware, if not found, The words "68013 EEPROM MISSING" will be displayed in Device Manager.
4) Detailed INF configuration methods refer to Cyusb.pdf part1/part2/part3. This is not a repeat.
5) Install the driver to find the modified Cyusb.inf file, the driver will be installed correctly, the device can be used normally.
4.4 Testing Process
1) Properly identified devices can see the device information on the Cypress console. As shown in figure:
2) for specific use of CYPRESS console, please refer to Cyconsole.chm.
3) Note that, in addition to EP0/EP1, when the other endpoint Max Pkt size is 64 bytes, indicates that working in USB 1.1 mode, there may be a reason for the software, or there may be a problem with the peripheral pull-up resistor. Special attention should be paid to the development.
5. Recommended development process
5.1 Read the book about the USB 2.0 protocol and learn about the USB 2.0 protocol. Recommended "USB 2.0 Principles and engineering development"
5.2 See cyusb.pdf documentation. Learn about driver installation methods.
5.3 See Keil C51 Books, familiar with C51 programming methods, familiar with the Keil C programming environment.
5.4 Look at the routines provided by Cypress to learn about the 68013A programming framework. Recommended "EZ-USB 2100 series single-chip microcomputer principle, programming and Application" (Basic frame similar, partial register definition is different).
5.5 Control USB 2.0 protocol, write Dscr.a51 file, configure various descriptors.
5.6 Combined with FX2 Techrefmanual.pdf, studied fw.c, Periph. C, Fx2regs. H, FX2. H, understand the definition of registers.
5.7 Write the response code according to the system requirements, when there is a development board, according to the development version of the led to test the correctness of the program.
5.8 According to Cyapi.pdf Cyusb. PDF to write the host computer communication program.
Synchronous Read Data method Xferdata ();
Asynchronous Read Data method Begindataxfer ()/waitforxfer ()/finishdataxfer ();