From: Chris Morgan <chmorgan@xxxxxxxxx>
Sent: Friday, February 15, 2019 6:02 PM
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Subject: Re: libftdi bitbang events?
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.
Huh. I wonder how I missed this factoid. I guess I just assumed that since devices are discovered automagically by the OS, there must be some event driven mechanism.
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.
- What is your desired latency?
- Do you expect multiple signal transitions to occur? If sp, how often?
This could be workable. We are using the 4232H device, which has mpsse functionality. Essentially, there is a momentary switch closure which we'd like to detect a leading edge transition.
The switch input is used to turn on WiFi for a short period of time, which timeout will be handled in the software. Another similar momentary switch is to be used to tell the Rpi to configure itself in some known default application state. So
to answer your question, I don't think that latency is too terribly important. Nor do I think that we expect to need to handle multiple transitions since both of these operations are essentially one-shot.
So, if you are willing and/or able to share more details about how you set this up, I'd be a rapt listener. :D
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|