Ubuntu OpenOCD communicating with FT2232H
dependencies
- ubuntu 系统 + 安装openocd
- OpenOCD User’s Guide
Installing OpenOCD on Ubuntu
注: 本次实验中使用的系统为ubuntu 20.04
- ubuntu 20.04 安装 openocd version 0.10.0 (偷懒式安装) , 最新版本为version 0.11
$ sudo apt-get install openocd
- 查看openocd安装版本以及安装路径
$ openocd -v
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
$ dpkg -S openocd
openocd: /usr/share/openocd/scripts/chip/st/stm32/stm32_rcc.tcl
openocd: /usr/share/openocd/scripts/target/test_syntax_error.cfg
openocd: /usr/share/doc/openocd/loaders/flash/fm4/Makefile
openocd: /usr/share/doc/openocd/loaders/flash/xmc1xxx/xmc1xxx.S
openocd: /usr/share/openocd/scripts/board/keil_mcb1700.cfg
openocd: /usr/share/openocd/scripts/target/lpc2148.cfg
openocd: /usr/share/openocd/scripts/target/kl25z_hla.cfg
openocd: /usr/share/openocd/scripts/target/fm4_s6e2cc.cfg
openocd: /usr/share/doc/openocd/loaders/watchdog/armv7m_kinetis_wdog.inc
openocd: /usr/share/openocd/scripts/target/at91sam3nXX.cfg
openocd: /usr/share/doc/openocd/loaders/flash/xmc1xxx/erase.inc
openocd: /usr/share/openocd/scripts/interface/ftdi/luminary-lm3s811.cfg
openocd: /usr/share/openocd/scripts/target/lpc4370.cfg
openocd: /usr/share/info/openocd.info-1.gz
openocd: /usr/share/openocd/scripts/board/ek-lm3s9b9x.cfg
openocd: /usr/share/openocd/scripts/cpu/arm/arm7tdmi.tcl
....
- 连接FT2232H适配器,输入
lsusb
看到 ****Ltd FT2232C/D/H ****
$ lsusb
Bus 001 Device 009: ID 0403:6010 Future Technology Devices International, Ltd FT2232C/D/H Dual UART/FIFO IC
- 或连接FT2232H适配器,输入
dmesg
$ dmesg
......
[82466.144555] usb 1-1: Detected FT2232H
[82466.164331] usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0
[82466.186438] ftdi_sio 1-1:1.1: FTDI USB Serial Device converter detected
[82466.186538] usb 1-1: Detected FT2232H
[82466.204076] usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB1
[82974.227511] ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB1
Communicating with FT2232H
注:
OpenOCD v0.11.0 与 OpenOCD v0.10.0由些许命令不一样会报错!!!!!!
标准冒烟测试——点灯:通过OpenOCD的配置文件点亮,FT2232H硬件板上的led灯。
在ubuntu终端输入,openocd -f openocd.cfg
,即可点亮两颗LED(原理图见FT2232H入门)。
# openocd.cfg
interface ftdi
ftdi_vid_pid 0x0403 0x6010
# ftdi_channel 0 is port ADBUS, ftdi_channel 1 is port BDBUS.
ftdi_channel 1
# transport select transport_name
# Select which of the supported transports to use in this OpenOCD session
transport select jtag
adapter_khz 1000
# ftdi_layout_init data direction
# Specifies the initial values of the FTDI GPIO data and direction registers
ftdi_layout_init 0x00F8 0x00fb
ftdi_layout_signal nSRST -oe 0x0040
ftdi_layout_signal ntRST -oe 0x0010