libftdi Archives

Subject: Re: ftdi_set_bitmode question

From: Jo Schambach <jschamba@xxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 25 Jul 2011 21:08:43 -0500
Hi Chris,
thanks for the suggestions. I will try to use the the enable_bitbang
function tomorrow and see if it works for me.
The MorphIC-II has the JTAG pins of the Cyclone-II brought to a
programming header, so I am using that one to program the FPGA, and also
to "watch" the FPGA over signaltap. So there is no conflict with any
other library on that PC, since I program the board from a different PC.
When I tried to use the ftdi_set_bitmode function, I can see the FPGA
going non-configured over the signaltap the moment this function is
called, so I agree that something is changing the state of NCONFIG pin.
I thought that by declaring that pin an input on the FT2232, it wouldn't
affect the state of that pin, just as it didn't affect it when I used
the ftd2xx library.
I guess my point was that the ftd2xx library seems to work as I expected
it to, but the ftdi library didn't.....

Cheers,
Jo

On 7/25/2011 7:54 PM, Chris Zeh wrote:
> Hi Jo,
>
> I've been working on a project where I configure an FPGA (Cyclone II)
> using the FT232RL, from my understanding the two are very similar to
> communicate with.
>
> I mentioned in my blog post
> (http://idle-logic.com/2011/03/05/programming-an-altera-cyclone-ii-fpga-with-a-ft232rl-python-code)
> that I was having problems using the SetBitMode function, I don't
> recall why but it wasn't working for me at the time. The documentation
> said it's depreciated, but I ended up using the enable_bitbang
> function instead and it worked for me.
>
> I'm curious what you're using to program the FPGA, a 3rd party
> application? Possibly it uses the libftd2xx library and there is a
> glitch on the handover to the libftdi library?
>
> If that NCONFIG pin gets pulled low you'll reset the FPGA into
> configuration mode, which is what I'm guessing is happening. If you
> set the NCONFIG to an output and keep it high does the device also
> reset?
>
> Just throwing out some ideas... perhaps someone with more experience
> can chime in :-)
>
> Best regards,
> Chris Zeh
>
> On Mon, Jul 25, 2011 at 3:45 PM, Joachim Schambach
> <jschamba@xxxxxxxxxxxxxxxxxx> wrote:
>> 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
>>
>>
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   
>

-- 
Dr Joachim Schambach
The University of Texas at Austin
Department of Physics
1 University Station #C1600
Austin, Texas 78712-0264, USA
(512) 471-1303, FAX: (781) 998-5513
email: jschamba@xxxxxxxxxxxxxxxxxx


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

Current Thread