它的调用底层也是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代码看起来是一种比较靠谱的方式。
这个项目是采用的swig与python之间进行交互接口,数据的传递是通过char *, 但是char *处理char值>0x80的有很不方便的地方会插入0xffffffc2,造成数据处理困扰。最好应该能有支持unsigned char *的。--- 目前还没有找到方法,不确定是不是swig版本的问题。 --- 这个需要使用c与python bytes相互转换的功能。 具体请参考 使用swig连接python与c
pip install pyftdi
, https://pypi.org/project/pyftdi/, https://eblot.github.io/pyftdi/
纯python实现,没有调用libftdi, 估计是直接调用的libusb。目前包装好对外的函数没有支持pause_ir/dr,需要自己稍稍修改一下。
-- 重要:目前这个开源代码还有问题:
安装方式:管理员方式运行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:
Features
PyFtdi currently supports the following features:
Supported host OSes
Windows, although not officially supported
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模式。
这个是开源的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.
window python ftdi
原文链接: https://blog.csdn.net/witner_dm/article/details/82732476
此方案自己没有试通,python调用时出现了大概DLL找不到的问题,
还是用自己编写DLL的方式给python用靠谱点。