libftdi Archives

Subject: Re: LibFTDI send problem

From: Matthias Janke <matthias.janke@xxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 22 Mar 2012 11:35:30 +0100
Am Wed, 21 Mar 2012 22:56:55 +0100
schrieb Tim Schneider <schneid5@xxxxxxxxxxxxxx>:


> Interestingly I did find a workaround that seems to always work:
> I am now sending my command byte per byte and always pausing for a second in
> between each write. So far I was successful with this workaround even though
> it's really not a pretty solution :( Could it have something todo with the
> (low) baudrate of only 9600 of the chip?

Do you check how many bytes were written? You might need do resend parts of your
message like:

do
    if((ret = ftdi_write_data(&ftdic, (unsigned char *)buf +i, bytes-i )) >= 0) 
        i+= ret;
    else
        break;
while(i < bytes);

Sometimes playing with the latencytimer or the read/write chunksize also gives
good results, but not always.


> 
> Am 21.03.2012 um 10:28 schrieb Matthias Janke:
> 
> > Hi Tim,
> > 
> > Am Wed, 21 Mar 2012 09:24:52 +0100
> > schrieb Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>:
> >>> My device periodically sends sensor data across the usb interface once it
> >>> received the start command, which is just the word "start" send in ascii
> >>> letters to the device. Unfortunately the sending of the start command
> >>> somehow fails. 
> >> 
> >> We had trouble back in the days with the first write command
> >> getting lost. When we tried to track it down, the problem vanished.
> > 
> > I had this problem where the first byte of the first write got lost only 
> > with
> > the 0.x branch. I'm now using the 1.x branch and never lost any byte in
> > sending or reading, even though it takes usually more than one read to get
> > all bytes of a transmission. 
> > 
> > Cheers,
> > Matthias
> > 
> > 
> > 
> > --
> > libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> > To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   
> > 
> 
> 
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   


-- 
---------------------------------------------------------------------
 Dipl.-Phys. Matthias Janke

 Physikalisches Institut der Universität Heidelberg
 Philosophenweg 12
 69120 Heidelberg
 Deutschland

 Tel:    +49 (6221) 54 93 72
 Fax:    +49 (6221) 54 94 52
 E-Mail: matthias.janke@xxxxxxxxxxxxxxxxxxxxxxx

 Büro:
 Albert-Überle-Straße 3-5
 Zi. 158, Ostflügel, 1.OG
---------------------------------------------------------------------

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

Current Thread