libftdi Archives

Subject: Re: I/O stops working on program restart

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: jeffdelmerico <jad4@xxxxxxxxxx>
Date: Thu, 24 Oct 2013 14:40:16 +0200
Hi Jeff,

On Monday, 14. October 2013 17:45:05 jeffdelmerico wrote:
> I am developing a Linux driver for a sonar sensor that uses a 2232C chip
> in its top box to communicate over serial with the sonar head.  The basic
> workflow is that upon startup, the driver writes a series of messages to
> the TX buffer to set up some parameters, and then a message that tells
> the sonar to start pinging, at which point the driver starts pulling the
> returned data off of the RX buffer periodically.  I'm using the C++
> bindings to libftdi.
> 
> My problem is that the first time I run the driver program, it works just
> fine, but every subsequent time that I run it, the initial writes to the
> TX buffer timeout once they hit 128 bytes. However, if I power cycle the
> top box or unplug/replug the USB, the driver works again, but only the
> first time.  Regardless of whether the writes succeed or timeout, a call
> to Context::close() return successfully.  Having to power cycle the
> device each time is undesirable because this sensor is connected to an
> embedded system on an autonomous vehicle.
> 
> I haven't been able to find references to similar problems on this forum,
> or elsewhere on the web, but perhaps I've overlooked something.  Any
> assistance would be much appreciated, and I'll be happy to provide more
> info on request.

could it be that the microcontroller behind the FTDI chip
keeps sending data and when the first program run finishes,
it gets stuck because no one is fetching the data from the FTDI chip?

You could try to read all available data on program startup from the FTDI 
chip *before* sending the "start ping" command to the sonar.

Just a wild guess though.

Thomas


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

Current Thread