libftdi Archives

Subject: RE: Writing and reading to a FT232R

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 7 Nov 2011 14:02:19 +0100
>>>>> "Ampt,Maurice" == Ampt,Maurice M L <m.ampt@xxxxxxxxxxxxxxxxx> writes:

    Ampt,Maurice> Ok, I still haven't figured out what I'm doing wrong...
    >> From my last response:

    Ampt,Maurice>     Uwe, Bonnes>Thats the problem of the
    Ampt,Maurice> ../include/libusb-1.0/libusb.h versus usb.h from usb.h Are
    Ampt,Maurice> you sure you have libusb-1.0-dev?

    Ampt,Maurice> I just completely cleared my system of libusb and libftdi
    Ampt,Maurice> and got libusb 1.0.8 from
    Ampt,Maurice> http://sourceforge.net/projects/libusb/files/latest This
    Ampt,Maurice> was done because you suggested to get the most recent
    Ampt,Maurice> version instead of relying on packages.  Because of that I
    Ampt,Maurice> also got the most recent libftdi from the same source as
    Ampt,Maurice> before, this is version 0.19.

    Ampt,Maurice> Extracting libusb, running ./configure --prefix=/usr and
    Ampt,Maurice> running make install gave me
    Ampt,Maurice> /usr/include/libusb-1.0/libusb.h, The same actions were
    Ampt,Maurice> applied to libftdi.  Upon examining ftdi.h I discoved it
    Ampt,Maurice> now says #include <usb.h>, this solves my incorrect
    Ampt,Maurice> libusb.h reference.  (I haven't changed anything since I
    Ampt,Maurice> downloaded, configured and installed these 2 libraries.)

    Ampt,Maurice> My code is compiling and running however I still have the
    Ampt,Maurice> problem I started with: Sending a command once will almost
    Ampt,Maurice> never trigger the desired result, sending a command twice
    Ampt,Maurice> however does but this can't be the way it's supposed to
    Ampt,Maurice> be.  My ftdic.baudrate = -1211216896 problem is now gone
    Ampt,Maurice> too because I now am using the correct headers.  However
    Ampt,Maurice> as I said, still no good results with writing, any ideas
    Ampt,Maurice> what might be causing this?

As with every hardware/software/firmware setup, try to find the failing
part. That was the reason why I suggested the examples/testserial. Does that
run now ? And there may be even problems with the cables, the connectors or
the USB port on the PC. 

Otherwise the description you started with:
"So only 1 ftdi_write_data will work maybe 1 out of 10 times where calling
the ftdi_write_data function twice hasn't failed me yet..." 

is written in a way that I understand nearly nothing. I changed
serial_test.c to do only one write and it always succeeded. Maybe RTS/CTS or
some other controlling line is in a bad state.

Also
"Also about that read function it doesn't matter wether I make the size
parameter bigger, smaller or equal to what I am going to receive, it says it
never receives data. (I also checked the read timeout, it is set to 5000,
changing made no difference whatsoever)" 

is somethimng to check with a scope. If the connected device never sends
something, you will never receive someting (probably...)

Then the connected device has probably some small microcontroller, so there
may be substantial delay befor the answer can be read.

So much things to check...

Bye

-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

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

Current Thread