libftdi Archives

Subject: writing to FT245R

From: Howard Coven <hcoven@xxxxxxxxxxx>
To: <libftdi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 4 Nov 2009 16:14:41 -0800
i'm trying to use the libftdi to write to a FT245R chip using the standard protocol.

here is the main part of my code

///////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include "ftdi.h"

int main(void)
{
        struct ftdi_context ftdic;

// all declarations, intializization  , etc..

 if (ftdi_init(&ftdic) < 0)
    {
        fprintf(stderr, "ftdi_init failed\n");
        return EXIT_FAILURE;
    }

    if ((ret = ftdi_usb_open(&ftdic, 0x0403, 0x6001)) < 0)
    {
        fprintf(stderr, "unable to open ftdi device: %d (%s)\n", ret, ftdi_get_error_string(&ftdic));
        return EXIT_FAILURE;
    }
if ((ret = ftdi_write_data(&ftdic, outBuff, 34))<0)
    {
        printf("write failed ! \n\r");
    }   
        else printf("#ofBytesWritten: %d\n\r",ret);

/////////////////////////////////////////////////////////////

I don't get any errors, but the ftdi_write_data function does not seem to
be having any results writing to the device.
I do seem to be able to connect & read from the device,
so i'm not sure what is wrong.

notice i'm merely including the ftdi files ,(  #include "ftdi.h" )
as i have put them in the same directory as my main.
do i have to first install the libftdi for it to work correctly.
i'm running Ubuntu 9.04
linux 2.6.28-16-generic

thanks!
Howard


Bing brings you maps, menus, and reviews organized in one place. Try it now.

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


Current Thread