Replies: 1 comment 1 reply
-
We have identified the issue which lies in the d2xx.py module. When a d2xx._Device object is created, only the "default" interface object (d2xx._Handle) is given an "rx_event". The hardcoded default interface is 1. So of the four available interfaces on the FT4232H, only interface-1 has the "rx_event" set and the other three are "None". I have been using interface-0 and because the "rx_event" is set to "None", the bulk_read function returns 0. I have been able to work around the issue by putting in a guard clause to check for None rx_events. I can't help but feel that I am either setting this up incorrectly, or that multiple interfaces are not accommodated for correctly. I would post this in the pyftdiwin repo, but there is no issue tracker or discussion page enabled. Changed code below: |
Beta Was this translation helpful? Give feedback.
-
Hello. I am using pydfti (pftdiwin) on Windows 10 in a Jupyter notebook with Python 3.11.0 to interface between a 4232H and an obtuse SPI device. The device uses SPI mode 3 and requires chip select to toggle between each byte. I already know that the interface works, as we have achieved communications using a C# program on the same hardware. I am moving to python to incorporate this interface with other features of the system.
I originally tried the naïve approach of using the built-in functions of the SPI module (exchange, write and read), following the examples, which yielded no results. Because of the vagaries of the implementing SPI mode 3 and this devices communications requirement, the C# implementation actually does a lot of the "prolog", "epilog" and clock setting stuff programmatically, rather than rely on the FTDI interface.
I reproduced the command set that is sent to the FTDI and have been able to produce the same signals as the C# program. The device does respond to the signals, but no data is returned from the "read" function. After a lot of testing, it turns out that the device was responding to the earlier naïve approach but because of the null data returns, I thought that it wasn't working.
In an effort to track down the issues, I thought I could enable the loopback connection and at least prove that data can be returned, but I am still getting null bytes.
Am I missing something? Is there another approach I could try?
I would appreciate any help or feedback.
Beta Was this translation helpful? Give feedback.
All reactions