问题
I am trying to open a connection and pass a value for a given channel In order to do this I need to open a connection to the enttec open dmx usb. But I am unable to create a connection
I tried to list devices and make sure the SN matches with the HW
In [34]: import ftd2xx as ft
In [35]: ft.listDevices()
Out[35]: [b'AL05J8AO']
In [36]: ftd2xx.openEx('AL05J8AO', ftd2xx.ftd2xx.OPEN_BY_SERIAL_NUMBER)
---------------------------------------------------------------------------
DeviceError Traceback (most recent call last)
<ipython-input-36-9780ebf9f5e6> in <module>
----> 1 ftd2xx.openEx('AL05J8AO', ftd2xx.ftd2xx.OPEN_BY_SERIAL_NUMBER)
~/raj3_env/lib/python3.6/site-packages/ftd2xx-1.1.0rc1-py3.6.egg/ftd2xx/ftd2xx.py in openEx(id_str, flags)
106 instance for it"""
107 h = _ft.FT_HANDLE()
--> 108 call_ft(_ft.FT_OpenEx, id_str, _ft.DWORD(flags), c.byref(h))
109 return FTD2XX(h)
110
~/raj3_env/lib/python3.6/site-packages/ftd2xx-1.1.0rc1-py3.6.egg/ftd2xx/ftd2xx.py in call_ft(function, *args)
42 status = function(*args)
43 if status != _ft.FT_OK:
---> 44 raise DeviceError(status)
45
46 def listDevices(flags=0):
回答1:
To the best of my knowledge the VCP driver is loaded by default for non windows systems (or if the EEPROM is flashed accordingly). Chances are that you have to unload the VCP first to enable the D2XX driver. To check if this is the case for you, you can try to start one of the examples provided by ftdi. Furthermore you could try to address the device not by SN but by port number.
If the VCP is the problem, it can be removed via "sudo rmmod ftdi_sio". Sometimes an additional "sudo rmmod usbserial" is required.
Some alternative solutions and approaches are discussed here
EDIT:
An alternative might be sticking with the VCP driver and just opening it via e.g. pyserial. If I see it correctly the device you want to interface actually has a RS485 with BaudRate = 250000, PARITY_NONE, STOP_BITS_2, BITS_8 according to the code example they provide. So a long as no special GPIO access is required, you might be good. But chances are that you might have problems with opening the VCP as well and that you have to fix a driver problem first. Sadly I am not an expert in this field...
来源:https://stackoverflow.com/questions/57119708/unable-to-open-a-connection-with-a-ftd-232-device