libftdi Archives

Subject: Re: ftdi_write_data unstable on 2.6 Works perfect on 2.4

From: "J.C. Wren" <jcwren@xxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 28 Jul 2009 09:53:02 -0400
I have an 8 channel relay board that is controlled by an FT245RL.  I needed to get the board running under Linux, so I loaded up ftdilib and wrote a small control program (only to discover that examples/bitbang2.c did almost exactly what I needed, so I managed to reinvent the tire and lugnuts, but still needed a hubcap :) ).

The application opens the board, reads the current port value, turns certain relays on or off, then writes it back.  The application is called from the command line as necessary as part of a script.

Anyway, some of the time it was working great, other times I'd write data with ftdi_write_data() and nothing changed.  I found this thread about ftdi_write_data() being unstable under 2.6, and I think this applies to me (http://developer.intra2net.com/mailarchive/html/libftdi/2009/msg00142.html)

I worked around this by reading the value (which always seems to work), then rewriting it 256 times before writing the modified value.  Under 100 tests it has worked fine (so far). 

I also tried bitbang2.c, with the same results.  Sometimes, it just doesn't "take".  No errors or anything, it's more like the data isn't getting flushed to the FT245.  The message above references using usb_reset(), but I wasn't sure where that would be placed to be applicable.

Any thoughts on what the underlying problem would be?  Is it a libftdi problem, or a kernel USB issue?  This same board is used daily under Windows (bleh) and hasn't ever exhibited this problem.

Thanks!
--jc


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


Current Thread