香橙派4 2. 驱动usb2.0芯片cy7c68013

0. 环境

- 香橙派4(Orangepi4_2.1.2_ubuntu_bionic_desktop_linux4.4.179.img)
- EZ-USB FX2LP CY7C68013A USB 核心板

香橙派4 2. 驱动usb2.0芯片cy7c68013_第1张图片

 

1. 下载FX3_SDK_1.3.4_linux

EZ-USB™ FX3 Software Development Kit
https://www.infineon.com/cms/en/design-support/tools/sdk/usb-controllers-sdk/ez-usb-fx3-software-development-kit

2. 解压

压缩文件放到/home/orangepi/work/FX3_SDK_1.3.4_Linux.tar.gz

解压

tar -zvxf FX3_SDK_1.3.4_Linux.tar.gz

得到了
fx3_firmware_linux.tar.gz
ARM_GCC.tar.gz                    # 交叉编译工具
eclipse_x64.tar.gz                # IDE
eclipse_x86.tar.gz
cyusb_linux_1.0.5.tar.gz        # cyusb驱动

继续解压

tar -zvxf fx3_firmware_linux.tar.gz && \
tar -zvxf ARM_GCC.tar.gz && \
tar -zvxf eclipse_x64.tar.gz && \
tar -zvxf cyusb_linux_1.0.5.tar.gz

3. 测试cyusb_linux


这个软件是开源的,编译安装

cd cyusb_linux_1.0.5
make 
sudo ./install.sh


 
问题1:lib/libcyusb.cpp:20:10: fatal error: libusb-1.0/libusb.h: No such file or directory
解决办法:sudo apt install libusb-1.0.0-dev

问题2:qmake-qt4: command not found
解决办法:sudo apt install qt4-qmake
sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos qt4-designer

问题3:/usr/lib/aarch64-linux-gnu/qt4/bin/uic: Command not found
不解决了。

这是图形界面依赖QT4,跳过了。直接用命令行。

编译命令行示例,命令行只需要安装g++并只依赖libusb、pthread:

orangepi@orangepi4:~/work/cyusb_linux_1.0.5/src$ make
g++ -o 00_fwload            00_fwload.cpp            -L ../lib -l cyusb
g++ -o 01_getdesc           01_getdesc.cpp           -L ../lib -l cyusb
g++ -o 03_getconfig         03_getconfig.cpp         -L ../lib -l cyusb
g++ -o 04_kerneldriver      04_kerneldriver.cpp      -L ../lib -l cyusb
g++ -o 05_claiminterface    05_claiminterface.cpp    -L ../lib -l cyusb
g++ -o 06_setalternate      06_setalternate.cpp      -L ../lib -l cyusb
g++ -o 08_cybulk            08_cybulk.cpp            -L ../lib -l cyusb -l pthread
g++ -o 09_cyusb_performance 09_cyusb_performance.cpp -L ../lib -l cyusb -l usb-1.0
g++ -o download_fx2         download_fx2.cpp         -L ../lib -l cyusb
g++ -o download_fx3         download_fx3.cpp         -L ../lib -l cyusb
g++ -o cyusbd               cyusbd.cpp               -L ../lib -l cyusb
gcc -o config_parser        config_parser.c          -L ../lib -l cyusb
orangepi@orangepi4:~/work/cyusb_linux_1.0.5/src$

测试命令行示例:


orangepi@orangepi4:~/work/cyusb_linux_1.0.5/src$ ./01_getdesc
bLength             = 18
bDescriptorType     = 1
bcdUSB              = 0x0200
bDeviceClass        = 0x00
bDeviceSubClass     = 0x00
bDeviceProtocol     = 0x00
bMaxPacketSize      = 64
idVendor            = 0x04b4
idProduct           = 0x1004
bcdDevice           = 0x0000
iManufacturer       = 1
iProduct            = 2
iSerialNumber       = 0
bNumConfigurations  = 1
orangepi@orangepi4:~/work/cyusb_linux_1.0.5/src$

 

4. bulkloop

4.1  下载buikloop固件到设备

orangepi@orangepi4:~/work$ cd cyusb_linux_1.0.5/src/
orangepi@orangepi4:~/work/cyusb_linux_1.0.5/src$ ./download_fx2 -h
./download_fx2: FX2LP firmware programmer
Usage:
        ./download_fx2 -h: Print usage information

        ./download_fx2 -i  -t : Program firmware from  to ,
                where  is one of:
                        "RAM ": Program to internal or external RAM
                        "SI2C": Program to small I2C EEPROM, IIC file to be provided
                        "LI2C": Program to large I2C EEPROM, IIC file to be provided

orangepi@orangepi4:~/work/cyusb_linux_1.0.5/src$ ./download_fx2 -i /home/orangepi/work/cyusb_linux_1.0.5/fx2_images/bulkloop.hex -t RAM
Found Hex format file
Info: Releasing FX2 CPU from reset
FX2LP firmware programming to RAM completed
orangepi@orangepi4:~/work/cyusb_linux_1.0.5/src$ 

4.2 测试bulkloop

这个示例是用户命令行输入一串字符,按下回车后会得到设备回传到的字符串。

orangepi@orangepi4:~/work/cyusb_linux_1.0.5/src$ ./08_cybulk
Successfully claimed interface
123
123
321
321
123
123
321
321


 

你可能感兴趣的:(嵌入式Linux,物联网,arm开发,c++,linux)