-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathftdipython.html
71 lines (66 loc) · 2.6 KB
/
ftdipython.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PYTHON LIBRARY FOR FT2232H</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1><a href="index.html">SHIENLONG</a></h1>
<hr>
<h2>PYTHON LIBRARY FOR FT2232H</h2>
<p>
<i>Updated 28 Sep 2023</i>
<p>
There is an extremely useful Python library written by Emmanuel Blot <a href="https://github.com/eblot/pyftdi">[eblot]</a>.
Instead of writing your own C++ code to call the ftd2xx.dll, and if you are familiar with Python programming language, then just use <a href="https://eblot.github.io/pyftdi/">
PyFtdi</a> which is like a wrapper for the dll.
<p>
It works for other FTDI devices as well.
The GitHub documentation is clear and quite easy to understand.
It does not officially support Windows.
There is a USB driver that seems complicated to install but fortunately <a href="https://pypi.org/project/pyftdiwin/">[Marius Greuel]</a> made PyFtdi much easier to use with Windows.
It is basically a version of PyFtdi that works with Windows.
</p>
<h3>Device URL</h3>
<p>
The FTDI device will have a specific hardware identifier.
I only have 1 device, there did not have any issues.
<p>
To show the FTDI device connected to your computer:
<pre>
from pyftdi.ftdi import ftdi
from io import StringIO
out = StringIO()
print(Ftdi.show_devices('ftdi:///?', out=out))</pre>
</p>
<h3>SYNCHRONOUS BIT BANG</h3>
<p>
There are several functions which can be used in bit-bang mode.
These functions can be found in the GPIO wrapper by <a href="https://github.com/eblot/pyftdi">[eblot]</a> which I link <a href="https://github.com/eblot/pyftdi/blob/master/pyftdi/gpio.py">here</a>.
<p>
MPSSE Controller example:
<pre>
from pyftdi.gpio import GpioMpsseController
ioOut = GpioMpsseController()
ioOut.configure (url=url, direction=0xFFFF, frequency=3E6)
ioOut.write(out=[1,4,6,1,13,15])
ioOut.close()</pre>
<p>
Synchronous GPIO example:
<pre>
from pyftdi.gpio import GpioSyncController
ioOut = GpioSyncController()
ioOut.configure(url=url, direction=0xFFFF, frequency=3E6)
ioOut.exchange(out=[1,4,6,1,13,15])</pre>
<p>
The GpioSyncController function is much faster compared to GpioMpsseController.
I was able to observe 600 bit stream with GpioSyncController vs 300 on GpioMpsseController.
</p>
<h2>OTHER PYTHON LIBRARY FOR FT2232H</h2>
<p>
This blog site by <a href="https://iosoft.blog/2018/12/02/ftdi-python-part-1/">[iosoft]</a> that uses <a href="https://pypi.org/project/ftd2xx/">ftd2xx</a> Python package (another wrapper for FTDI dll).
</p>
</body>
</html>