libftdi Archives

Subject: Re: ftdi_set_bitmode question

From: Joachim Schambach <jschamba@xxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 26 Jul 2011 15:54:25 -0500
Just to make sure that I am not doing something totally stupid, here is the code
that I am using (taking all the error checking out):

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

int main(void)
{
  int ret,i;
    struct ftdi_context ftdic, ftdic2;
    char buf[100];
    ftdi_init(&ftdic)
    ftdi_set_interface(&ftdic, INTERFACE_A);
    ftdi_usb_open(&ftdic, 0x0403, 0x6010)
    for (i=0; i<100; i++) buf[i] =  (char)i;
    ret = ftdi_write_data(&ftdic, buf, 100);
    // commenting the following line out will make this program fail to write on
a second call
    ret = ftdi_write_data(&ftdic, buf, 1);
    ftdi_usb_close(&ftdic)
    ftdi_deinit(&ftdic);

    return EXIT_SUCCESS;
}


Cheers,
Jo

On 7/26/2011 3:49 PM, Joachim Schambach wrote:
> Hi,
> I experimented some more with both drivers and just discovered another
> weirdness. maybe i need to send this as a separate subject thread to this 
> list,
> but since it is happening with the same module, maybe this is related.
>
> I wrote a simple application that just uses ftdi_write_data to send some data 
> to
> the MorphIC-II on channel A of the FT2232 and then observe the FPGA signals in
> signaltap. Initially I thought this was working correctly, but when I tried to
> execute the same application twice, the second time around I don't observe the
> AC[0] line (RXF#) going low, i.e. no data is being received into the FIFO from
> the Linux box. Yet on the Linux side, the call returns with no error, as if 
> the
> call succeeded.
> After some experimentation, I finally found that everything worked correctly
> again when I added a second ftdi_write_data call, even if that one only sent 
> 1 byte.
> So I tried the same thing with the libftd2xx library from FTDI, and indeed, 
> that
> one behaved the same way.
> However, when trying the same experiment on a Windows machine with the same 
> FPGA
> firmware, everything behaves as expected, i.e. repeatedly executing an 
> FT_WRITE
> (even a single call) worked all the time.
> So either I am missing something fundamentally, or something is weird with the
> Linux USB implementation. And yes, I did call rmmod ftdi_sio and rmmod 
> usbserial.
> Totally confused....
>
> Cheers,
> Jo
>
> On 7/26/2011 9:31 AM, Chris Zeh wrote:
>> Hi Jo,
>>
>> It is curious the difference between the two drivers, I'm hoping the
>> suggestions I sent you will help get everything going.
>>
>> I'm looking at the schematics for the Morph, pg27 and it looks like
>> the pull-ups are on the FPGA side. (possibly this is a different
>> product than what you're
>> using?).(http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_Morph-IC-II.pdf)
>>
>> Going through the documentation it looks like this board is designed
>> to program the FPGA using the Passive Serial (PS) configuration, which
>> would be using the FTDI instead of the JTAG. Typically if you're using
>> the JTAG to program the FPGA you would tie the MSEL[0:1] lines to GND.
>> (See page 409 http://www.altera.com/literature/hb/cyc2/cyc2_cii5v1.pdf).
>> Although JTAG is a bully and can program the FPGA no matter what the
>> MSEL pins are set too. I believe tying these lines to GND will make
>> the FPGA insensitive to glitches on the NCONFIG line. Looking at the
>> board schematics this might not be possible.
>>
>> Just some more details in case you're planning on laying out your own
>> board down the line...
>>
>> Let us know how it goes.
>>
>> Best regards,
>> Chris
>>
>>
>>
>>
>> On Tue, Jul 26, 2011 at 7:37 AM, Joachim Schambach
>> <jschamba@xxxxxxxxxxxxxxxxxx> wrote:
>>> From the schematics that FTDI provides it looks like there are no pullups or
>>> pulldowns on those lines, maybe the FPGA itself has some internal 
>>> pullups/downs.
>>> However, as you noticed, everything seems to work with the libftd2xx.
>>> The only reason I am working on this is that I noticed that the DEV_RST is 
>>> set
>>> high, when I do nothing to the B port. So all I am trying to accomplish is
>>> setting this one line to 0. Any functionality that  can  do this would work 
>>> for
>>> me, I just thought BITBANG would be the easiest.
>>> Jo
>>>
>>> On 7/26/2011 4:28 AM, Uwe Bonnes wrote:
>>>>>>>>> "Joachim" == Joachim Schambach <jschamba@xxxxxxxxxxxxxxxxxx> writes:
>>>>     Joachim> Hi, I have a question about the usage of the ftdi_set_bitmode
>>>>     Joachim> function.  I am using a development board from FTDI called
>>>>     Joachim> MorphIC-II to evaluate the usage of the FT2232HQ chip. This
>>>> ...
>>>>     Joachim> I am trying to use BITBANG mode to port B to set the DEV_RST
>>>>     Joachim> line to 0, while leaving the other pins alone (by setting them
>>>>     Joachim> as inputs). I have been able to do this with the libftd2xx
>>>>
>>>> What are you trying to achieve? What other function should the FT2232H do,
>>>> either seqential or simultanious? Why can't you use MPSSE to set the PINs?
>>>>
>>>> Otherwise, are there appropriate pull-up/downs to keep the input lines from
>>>> floating? But as it works with ftd2xx, there should be.
>>>>
>>>> In the next weeks I don't have time to investigate further...
>>>>
>>>> Bye
>>>>
>>> --
>>> 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                 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