用户工具

站点工具


linux:ftdi

这是本文档旧的修订版!


ftdi

1. 相关的开源库

1.1 libmpsse

它的调用底层也是libftdi

Open source library for SPI/I2C control via FTDI chips, https://github.com/devttys0/libmpsse

可以直接生成python接口,方便python调用,目前在windows环境试用过,目前只支持SPI/I2C接口的操作,可以自己根据MPSSE命令扩展以支持JTAG操作和MCU emulator接口操作。

依目前来看,自己在这个的基础上修改C代码看起来是一种比较靠谱的方式。

1.2 pyftdi

https://eblot.github.io/pyftdi/, 纯python实现,没有调用libftdi, 估计是直接调用的libusb。目前包装好对外的函数没有支持pause_ir/dr,需要自己稍稍修改一下。

-- 重要:目前这个开源代码还有问题:

  1. 其中write_dr会在TCK是出一个10ns左右的毛刺应该是个BUG,不知道是芯片还开源代码的问题
  2. write_dr, read_dr, shift_register,都没有实现在Exit1-DR时把最后一个bit的数据发送或接收功能,JTAG功能无法真正使用。

安装方式:管理员方式运行python3 setup.py install期间需要联网自动更新一些依赖包。

Overview

PyFtdi aims at providing a user-space driver for popular FTDI devices, implemented in pure Python language.

Suported FTDI devices include:

  1. UART and GPIO bridges
  2. FT232R (single port, 3Mbps)
  3. FT230X/FT231X/FT234X (single port, 3Mbps)
  4. UART and multi-serial protocols (SPI, I2C, JTAG) bridges
  5. FT2232C/D (dual port, clock up to 6 MHz)
  6. FT232H (single port, clock up to 30 MHz)
  7. FT2232H (dual port, clock up to 30 MHz)
  8. FT4232H (quad port, clock up to 30 MHz)

Features

PyFtdi currently supports the following features:

  1. UART/Serial USB converter, up to 12Mbps (depending on the FTDI device capability)
  2. GPIO/Bitbang support, with 8-bit asynchronous, 8-bit synchronous and 8-/16-bit MPSSE variants
  3. SPI master, with simultanous GPIO support, up to 12 pins per port, with support for non-byte sized transfer
  4. I2C master, with simultanous GPIO support, up to 14 pins per port
  5. Basic JTAG master capabilities
  6. EEPROM support (some parameters cannot yet be modified, only retrieved)
  7. Experimental CBUS support on selected devices, 4 pins per port

Supported host OSes

  1. macOS
  2. Linux
  3. FreeBSD

Windows, although not officially supported

1.3 pylibftdi

pylibftdi is a minimal Pythonic interface to FTDI devices using libftdi.

pip install pylibftdi, https://pypi.org/project/pylibftdi, https://github.com/codedstructure/pylibftdi

支持串口, BitBang模式。

1.4 libFTDI

这个是开源的c库(https://www.intra2net.com/en/developer/libftdi/index.php),官方的D2XX是闭源的C库

FTD2XX is a proprietary USB driver library developed by Future Technologies Devices International (FTDI), available from http://www.ftdichip.com. LibFTDI is an alternative open source USB driver library available from http://www.intra2net.com/en/developer/libftdi/.

FTD2XX is a closed-source library. A program licensed under the GNU General Public License (such as OpenOCD) cannot be distributed in binary form if linked to FTD2XX during compilation. LibFTDI is licensed under the GNU Lesser General Public License v2.1. Information on LGPL v2.1 is available at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.

linux/ftdi.1600787841.txt.gz · 最后更改: 2023/03/17 10:12 (外部编辑)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki