libftdi Archives

Subject: Re: libftdi bitbang events?

From: Chris Morgan <chmorgan@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 15 Feb 2019 20:02:00 -0500


On Feb 15, 2019, at 3:02 PM, Paul E Ourada <paul@xxxxxxxxxxxxxxxxxxx> wrote:

I have a question that I can't seem to find an answer for. I have been working with an FTDI 4232H device in bitbang mode for the last 9 months or so, among other things, on a Raspberry Pi data collection platform. Most of it has been in conjunction with controlling an Exar SP339 transceiver, and a FET to control power to the serial device. Pretty easy stuff. 

Now my employer wants to read the state of a momentary switch, but without having to stand on the device polling it every few milliseconds. I saw that the Rpi python GPIO library has a capability to get an event on the Rpi GPIO lines. 

I know that these are different from the FTDI GPIO lines. But I was wondering if anyone had implemented similar event driven functionality using libftdi? Or alternatively, could point me in a direction to implement such functionality myself? I'd be happy to contribute back to the project, if it can be done. From looking at the device docs, I'm not sure it can.

Hi Paul.

Usb is host driven, which means that the host is continually polling the device to see if it has data, you can make it event driven on the application side.

In our case we had a complex mpsse sequence that was waiting for a signal to transition and then we would issue several i2c read operations (until there was no data left to read or we ran out of read operations) and send the data back as a group. If I remember correctly we ended up using the usb handle directly at times. We were pulling touch events from an i2c touch controller and while we had some initial response latency due to usb polling rates we had really good performance with this approach.

Are you looking to identify a signal transition? You could make use of mpsse as we did (if you have an FTDI with an mpsse engine available). Then you could wait until the usb operation completed in your code rather than polling.

Some considerations:

- What is your desired latency?
- Do you expect multiple signal transitions to occur? If sp, how often?

Chris




libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx


Current Thread