libftdi Archives

Subject: ftdi_set_bitmode question

From: Joachim Schambach <jschamba@xxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 25 Jul 2011 16:45:38 -0500
Hi,
I have a question about the usage of the ftdi_set_bitmode function.
I am using a development board from FTDI called MorphIC-II to evaluate the usage
of the FT2232HQ chip. This board uses the A port as an IO port to communicate
with a Cyclone FPGA, and the B-Port is connected to the programming pins of the
FPGA as follows:
BD[0] = DCLK
BD[1] = DATA0
BD[2] = NCONFIG
BD[3] = NSTATUS
BD[4] = CONF_DONE
BD[7] = DEV_RST

I am trying to use BITBANG mode to port B to set the DEV_RST line to 0, while
leaving the other pins alone (by setting them as inputs). I have been able to do
this with the libftd2xx library as follows:
-----------ftd2xx code---------------------
  ftStatus = FT_Open(1, &fthandle1);
  UCHAR Mask = 0x80; // only bit 7 is output
  UCHAR Mode = 1;
  // Set bit-bang mode
  ftStatus = FT_SetBitMode(fthandle1, Mask, Mode);
  UCHAR Value = 0x0; //set all bits to 0
  ftStatus = FT_Write(fthandle1, &Value, 1, &BytesWritten);
------------end ftd2xx code -------------------

I am now trying to do the same thing with the libftdi library as follows:

----------libftdi code ---------------------------
ftdi_init(&ftdic2)
ftdi_set_interface(&ftdic2, INTERFACE_B);
ftdi_usb_open(&ftdic2, 0x0403, 0x6010));
ftdi_set_bitmode(&ftdic2, 0x80, BITMODE_BITBANG);
buf[0] = 0x0;
ftdi_write_data(&ftdic2, buf, 1);
-------- end libftdi code------------------------

But as soon as the ftdi_set_bitmode function is called, the FPGA seems to
reconfigure, as if one of the other pins (other than pin7) gets toggled.

Am I misunderstanding how to use the bitmask in this call? Or is there some
other problem that prevents me from using this library with this chip?

Regards,
Jo

-- 
Dr Joachim Schambach                 tel: x1 512 471 1303
The University of Texas at Austin    fax: x1 814 295 5111    
Department of Physics                email: jschamba@xxxxxxxxxxxxxxxxxx
1 University Station C1600
Austin, Texas 78712-0264, USA


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

Current Thread