0. 环境
- win10
- ubuntu22
- nanoDLA
提前获取到源码:-> 浏览器打开 https://github.com/wuxx/nanoDLA -> Download as zip.
硬件就直接用taobao买到的,原理图是
1. win10出厂测试
1.1 安装pulseview
nanoDLA-master\software\pulseview-0.4.1-64bit-static-release-installer.exe
1.2 安装驱动
插入 nanoDLA -> 识别出未知设备 ->
-> 打开 Zadig -> Options -> List All Devices -> 选择 nanoDLA对应的 Unknown Device -> 选择 WinUSB驱动 -> 点击 Install Driver
1.3 手上测试
nanoDLA连接USB转TTL模块测试,注意软件默认的采样频率无法正确解析出9600的波特率,这里调大到250kHz.
2. ubuntu22编译固件
2.1 解压源码
unzip nanoDLA-master.zip
cd nanoDLA-master
2.2 编译fxload
cd tools/fxload-2008_10_13
make clean
make
2.3 编译 fx2eeprom
cd tools/fx2eeprom
make
切换用户到root(dev/usb需要设置权限,我直接root了)
sudo -s
设置环境变量
export PATH=/home/xxjianvm/work/nanoDLA/nanoDLA-master/tools/fxload-2008_10_13:${PATH}
编译逻辑分析仪固件
cd ..
cd fx2eeprom
查看 nanoDLA对应的lsusb
# lsusb
Bus 002 Device 004: ID 1d50:608c OpenMoko, Inc. Fx2lafw
2.4 下载固件
修改 makefile
gedit MakeFile
把
VID = 04b4
PID = 8613
#VID = 0925
#PID = 3881
#sigrok-fx2-8ch
#VID = 1d50
#PID = 608c
修改为:
#VID = 04b4
#PID = 8613
#VID = 0925
#PID = 3881
#sigrok-fx2-8ch
VID = 1d50
PID = 608c
并把
cat ../../firmware/fx2lafw-sigrok-fx2-8ch-new.iic
修改为:
cat ../../firmware/fx2lafw-sigrok-fx2-8ch-c0.iic
下载:
$ make
$ make load && make write_fx2lafw
3. 测试
拔出设备再次接入电脑的usb。按照第一章节的win10进行测试。
4. 编译 fx2lafw(逻辑分析仪固件)
4.1 sdcc
浏览器打开 https://sourceforge.net/projects/sdcc/files/
下载得到 sdcc-3.9.0-amd64-unknown-linux2.5.tar.bz2
放到 ~/work/nanoDLA/sdcc-3.9.0-amd64-unknown-linux2.5.tar.bz2
解压
$ tar -jxvf sdcc-3.9.0-amd64-unknown-linux2.5.tar.bz2
设置环境变量
$ export PATH=/home/xxjianvm/work/nanoDLA/sdcc-3.9.0/bin:${PATH}
4.2 编译
$ sudo apt install autoconf
$ cd sigrok-firmware-fx2lafw-0.1.7
$ ./autogen.sh
$ ./configure
$ make
得到 hw/sigrok-fx2-8ch文件下的固件,详细路径是:
/home/xxjianvm/work/nanoDLA/sigrok-firmware-fx2lafw-0.1.7/hw/sigrok-fx2-8ch/fx2lafw-sigrok-fx2-8ch.fw
4.3 下载测试
$ cd nanoDLA-master/tools/fx2eeprom
修改Makefile
把
../../firmware/fx2lafw-sigrok-fx2-8ch-c0.iic
替换为
/home/xxjianvm/work/nanoDLA/sigrok-firmware-fx2lafw-0.1.7/hw/sigrok-fx2-8ch/fx2lafw-sigrok-fx2-8ch.fw
下载
$ export PATH=/home/xxjianvm/work/nanoDLA/nanoDLA-master/tools/fxload-2008_10_13:${PATH}
$ make load && make write_fx2lafw
顺利:
write on-chip, addr 0x0d03 len 17 (0x0011)
... WROTE: 3359 bytes, 41 segments, avg 81
reset CPU
Makefile:24: 002 005
cat /home/xxjianvm/work/nanoDLA/sigrok-firmware-fx2lafw-0.1.7/hw/sigrok-fx2-8ch/fx2lafw-sigrok-fx2-8ch.fw | ./fx2eeprom w 0x1d50 0x608c 16 > write.bin
Written 16 bytes
root@vmxxjian:/home/xxjianvm/work/nanoDLA/nanoDLA-master/tools/fx2eeprom#
5. 编译 PulseView
5.1 libserialport
$ sudo apt-get install git-core gcc make autoconf automake libtool
$ git clone git://sigrok.org/libserialport
或者
$ git clone https://github.com/sigrokproject/libserialport
$ cd libserialport
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
5.2 libsigrok
$ sudo apt-get install git-core gcc g++ make autoconf autoconf-archive \
automake libtool pkg-config libglib2.0-dev libglibmm-2.4-dev libzip-dev \
libusb-1.0-0-dev libftdi1-dev libieee1284-3-dev libvisa-dev nettle-dev libavahi-client-dev \
libhidapi-dev check doxygen python3-numpy python3-dev python-gi-dev python3-setuptools-git swig default-jdk
$ git clone git://sigrok.org/libsigrok # https://github.com/sigrokproject/libsigrok
$ cd libsigrok
$ ./autogen.sh
$ ./configure
$ make -j4
$ sudo make install
5.3 libsigrokdecode
$ sudo apt-get install git-core gcc make autoconf automake libtool pkg-config libglib2.0-dev python3-dev
$ git clone git://sigrok.org/libsigrokdecode # https://github.com/sigrokproject/libsigrokdecode
$ cd libsigrokdecode
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
5.4 sigrok-cli
$ sudo apt-get install git-core gcc make autoconf automake libtool pkg-config libglib2.0-dev
$ git clone git://sigrok.org/sigrok-cli # https://github.com/sigrokproject/sigrok-cli
$ cd sigrok-cli
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
5.5 pulseview
(4GB运存不够,需要开8GB运存,8GB也能跑满,用到一些swap区)
$ sudo apt-get install git-core g++ make cmake libtool pkg-config \
libglib2.0-dev libboost-test-dev libboost-serialization-dev \
libboost-filesystem-dev libboost-system-dev libqt5svg5-dev qtbase5-dev\
qttools5-dev qttools5-dev-tools
$ cd ~/work/nanoDLA
$ git clone git://sigrok.org/pulseview
或者
$ git clone https://github.com/sigrokproject/pulseview
$ cd pulseview
$ mkdir build && cd build
$ cmake ..
$ make
$ sudo make install
5.6 运行测试
$ sudo -s
$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
$ cd /home/xxjianvm/work/nanoDLA/pulseview/build
$ ./pulseview
问题:sr: fx2lafw: Unable to send start command: LIBUSB_ERROR_TIMEOUT.
解决办法:设置虚拟机的usb兼容性为 usb3.1