libftdi Archives

Subject: RE: MPSSE baudrate

From: Sivaram Gowkanapalli <sivaramreddy@xxxxxxxxxxx>
To: <libftdi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 31 Dec 2009 07:37:42 -0500
This is the code that I am referring to:

    // Set baudrate
    // if ( (f = ftdi_set_baudrate(ftdic, 115200)) < 0 ) {
    if ( (f = ftdi_set_baudrate(ftdic, 6000000)) < 0 ) { // 6 MHz?
        fprintf(stderr, "ftdi device: %d unable to set baudrate: %d (%s)\n", index, f, ftdi_get_error_string(ftdic));
        exit(-1);
    }
    if ( (f=ftdi_usb_reset(ftdic)) <0) {
       fprintf(stderr,"ftdi device: %d usb reset failed: %d (%s)\n",index, f, ftdi_get_error_string(ftdic));
        exit(-1);
    }
    // completely clear the receive buffer before beginning
    //while(ftdi_read_data(ftdic, rxbuf, bufsize)>0);
    // Clears the read buffer on the chip and the internal read buffer.
    if ( (f=ftdi_usb_purge_buffers(ftdic)) <0) {
       fprintf(stderr,"ftdi device: %d buffer purge failed: %d (%s)\n",index, f, ftdi_get_error_string(ftdic));
        exit(-1);
    }
    printf("ftdi device: %d enabling mpsse mode\n",index);
    if ( (f=ftdi_set_bit_mode(ftdic,0xFF,BITMODE_MPSSE)) <0) {
       fprintf(stderr,"ftdi device: %d cannot enable mpsse mode: %d (%s)\n",index, f, ftdi_get_error_string(ftdic));
        exit(-1);
    }
    if ( (f=ftdi_read_data_set_chunksize(ftdic, RXCHUNKSIZE)) < 0) {
        fprintf(stderr,"ftdi device: %d Can't set chunksize: %d (%s)\n",index, f,ftdi_get_error_string(ftdic));
        exit(-1);
    }
    printf("ftdi device: %d ftdi open succeeded(channel 1): %d\n",index, f);
    // got the below from http://developer.intra2net.com/mailarchive/html/libftdi/2009/msg000287.html
   unsigned char init_commands[] = {
         0x86, 0x00, 0x00, // initial clock frequency (6 MHz)
         0x80, 0x08, 0x0b, // initial line states
         0x85 // disable loopback
   };
   printf("ftdi device: %d sending initialisation commands\n",index);
    if ( (f=ftdi_write_data(ftdic, init_commands,sizeof(init_commands))) < 0) {
       fprintf(stderr,"ftdi device: %d write data error for initialisation commands: %d (%s)\n",index,f, ftdi_get_error_string(ftdic));
       exit(-1);
    }


From: sivaramreddy@xxxxxxxxxxx
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Subject: RE: MPSSE baudrate
Date: Thu, 31 Dec 2009 07:09:42 -0500

There is a function in the api called

ftdi_set_baudrate(ftdi_context,baudrate)

I am not sure if it is as simple as calling this function with a 3000000 for 3MHz or if there is some other calculation involved.

Does ftdi_set_baudrate(ftdi_context,3000000) == 3MHz MPSSE SPI mode?

I am trying to sample a 1.5 MHz signal on the "Data Input (DI)" pin of both channels(A & B).

Thanks
Siva


From: sivaramreddy@xxxxxxxxxxx
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Subject: MPSSE baudrate
Date: Thu, 31 Dec 2009 06:50:05 -0500


Hello,

I am a beginner to using FTDI chips and want to use FT4232H for sampling a 1.5 MHz line. I am hoping that if I could run MPSSE SPI at a baud rate of > 3Mhz or 6 Mhz, will give me a reliable sample.

I am struggling to understand how the baud rate interacts with MPSSE. I have been through the examples in the libftdi source and the mailing list, but am not having much luck. Any documentation that I can find on baudrate seems to be correlated with BitBang mode or UART mode.

Can anyone please guide me to where I can find more information on how the baudrate interacts with MPSSE SPI?

Thanks
Siva





Hotmail: Trusted email with powerful SPAM protection. Sign up now.

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



Hotmail: Powerful Free email with security by Microsoft. Get it now.

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



Hotmail: Trusted email with powerful SPAM protection. Sign up now.

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


Current Thread