Closed rdpoor closed 6 years ago
I think serial
(in sp = ft232.Ft232(serial, baudrate=19200)
) should be a FTDI Serial Number or a com port like COM3
. It is (almost certainly) not the serial
module which should be given.
The constructor of Ft232
can be found here: https://github.com/lsgunth/pyft232/blob/master/ft232/d2xx.py#L114
Note that D2xx
is imported under another name in https://github.com/lsgunth/pyft232/blob/master/ft232/__init__.py
You are correct. The sample docs could be clearer that serial
means serial_number
, not a pySerial instance, perhaps along these lines:
>>> import ft232
>>> devices = ft232.list_devices()
>>> print(devices)
[(b'A932QG17', b'FT232R USB UART')]
>>> serial_number = devices[0][0].decode('utf-8')
>>> print(serial_number)
A932QG17
>>> sp = ft232.Ft232(serial_number)
>>> print(sp)
D2xx<id=0x3055650>(port='A932QG17', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=10, xonxoff=False, rtscts=False, dsrdtr=False)
I'll leave this open as an enhancement request, but I won't be upset if Mr. Gunthorpe simply closes it.
Yup, thanks. I've tweaked the example to be more clear.
Hi All I am using the code to test, But is shows the error as below: Can someone help to heck it?
The devices returned by list_devices() are strings not bytes. Calling decode on them is not correct. Just print it directly.
Hi lsgunth
Thanks for your reply. Yes I can print the str. but How can I use ft232.Ft232 to open it?
sp = ft232.Ft232(serial_number, baudrate=115200) is wrong, it should be sp = ft232.Ft232(serial_number=serial_number, baudrate=115200)
I'm trying to bring up ft232 on my Win 10 32bit system under Python 3.6.4. I'm seeing the following:
Of course, this could be a driver or configuration error with pyserial. Any recommendations on where to look?
(P.S.: I'm excited by the potential of pyft232 since it promises just what I need: bitbang access to the FT232R while maintaining pyserial and FTDI drivers.)