FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: 30MHz SPI CLOCK Frequency in FT2232H mini module  (Read 1701 times)

steve

  • Newbie
  • *
  • Posts: 7
    • View Profile
30MHz SPI CLOCK Frequency in FT2232H mini module
« on: May 11, 2022, 01:58:22 PM »

Hello,

I am using FT2232H mini module with lib-MPSSE file for SPI.
We want 30MHz SPI Clock. we tried to change clockrate function from lib-MPSSE example code so we entered frequency which we want but not able to achieve 30MHz clockrate.

channelConf.ClockRate = 5000;
channelConf.LatencyTimer= 255;
channelConf.configOptions = \
SPI_CONFIG_OPTION_MODE0 | SPI_CONFIG_OPTION_CS_DBUS3;
channelConf.Pin = 0x00000000;/*FinalVal-FinalDir-InitVal-InitDir (for dir 0=in, 1=out)*/

We tried to change above example. so can anyone help me with this code and how to get 30MHz clock rate.
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 800
    • View Profile
Re: 30MHz SPI CLOCK Frequency in FT2232H mini module
« Reply #1 on: May 12, 2022, 03:03:19 PM »

Hello,

you can try the following:

channelConf.ClockRate = 30000000; // 30 MHz;
channelConf.LatencyTimer = 2; //2ms
channelConf.configOptions = SPI_CONFIG_OPTION_MODE0 | SPI_CONFIG_OPTION_CS_DBUS3 | SPI_CONFIG_OPTION_CS_ACTIVELOW;
channelConf.Pin = 0x00000000;

this should set the clock rate to 30MHz.


here is some useful documentation for you:

http://www.ftdichip.com/Support/Documents/AppNotes/AN_135_MPSSE_Basics.pdf
http://www.ftdichip.com/Support/Documents/AppNotes/AN_108_Command_Processor_for_MPSSE_and_MCU_Host_Bus_Emulation_Modes.pdf

Best Regards,

FTDI Community
Logged

steve

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: 30MHz SPI CLOCK Frequency in FT2232H mini module
« Reply #2 on: May 16, 2022, 05:37:52 AM »

Hello,

Thank you for suggestion.

we tried your configuration in our code, we achieve 30MHz Clockrate but SPI write and SPI read time is not synchronised with clock. we are missing some bits while we read data from slave.

Do you have any idea on that?


Thanks
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 800
    • View Profile
Re: 30MHz SPI CLOCK Frequency in FT2232H mini module
« Reply #3 on: May 16, 2022, 03:02:41 PM »

Hello,

have you made sure to initialize the states of the MPSSE pins? command 0x11 makes the clock start low and command 0x10 makes the clock start high.

section 3.3 of https://www.ftdichip.com/Support/Documents/AppNotes/AN_108_Command_Processor_for_MPSSE_and_MCU_Host_Bus_Emulation_Modes.pdf explains this further.

Best Regards

FTDI community
Logged

steve

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: 30MHz SPI CLOCK Frequency in FT2232H mini module
« Reply #4 on: May 18, 2022, 05:22:33 AM »

Hello,

I have Checked all MPSSE initialization commands and they are properly initialized.

We are using clockrate of 6 MHz before that time Read and Write working properly. After changing clockrate to 30MHz as per your suggestion, we are facing problem in Write and Read operation.

for eg. with 30MHz Clockrate,
          in Write operation (Address 0x800 & Data = AA)
          During Read Operation (Address 0x800 & Data = 55)

Do you have any suggestion on that?


Thanks
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 800
    • View Profile
Re: 30MHz SPI CLOCK Frequency in FT2232H mini module
« Reply #5 on: May 18, 2022, 10:57:03 AM »

Hi,

are you able to send a scope capture of the FT2232H end and at the SPI device end to see if the waveform timing and signal integrity looks ok? 

it may be also worth checking if the SPI device you are using is also in mode0 as the MPSSE engine in the FT2232H isn't compatible with SPI modes 1 and 3


Best Regards,

FTDI Community 
Logged

steve

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: 30MHz SPI CLOCK Frequency in FT2232H mini module
« Reply #6 on: May 19, 2022, 07:14:53 AM »

Hello,

Here i have attached scope images of SPI Write and SPI Read operation with clockrate of 30MHz.

For SPI Write:
Address: 0x3F6, Data: AA

With SPI Read,
Address: 0x3F6, Data: 55

Please check the images and let me know.
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 800
    • View Profile
Re: 30MHz SPI CLOCK Frequency in FT2232H mini module
« Reply #7 on: May 20, 2022, 11:20:05 AM »

Hello,

from the wave forms it looks like the data is changing on the rising edge of the clock. you are using SPI mode 0, in this mode the data should be changing on the falling edge of the clock.

it looks like you have the set configuration mode correctly, so this shouldn't be happening. could you run your original code that you first posted and send the wave forms of that please? just so we can compare.

Best Regards
FTDI Community   
Logged

steve

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: 30MHz SPI CLOCK Frequency in FT2232H mini module
« Reply #8 on: May 23, 2022, 06:57:09 AM »

Hello,

Yes I am using SPI mode 0 and i have also captured data with previous code which we are using for data transfer, in that code everything is working fine.

In the image, i have set clockrate of 6MHz(which we are using previously) and
SPI Write: 0x3F6, AA
SPI Read: 0x3F6, AA


Thank you


Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 800
    • View Profile
Re: 30MHz SPI CLOCK Frequency in FT2232H mini module
« Reply #9 on: May 24, 2022, 04:24:12 PM »

Hi,

the captures don't look as if it is mode0, which is weird because you seem to have set it right in the code. what version of LibMPSSE are you using?


Best Regards,

FTDI Community
Logged

steve

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: 30MHz SPI CLOCK Frequency in FT2232H mini module
« Reply #10 on: May 25, 2022, 05:23:52 AM »

Hi,

We are using LibMPSSE V1.1. And I have selected the SPI MODE0 in code. But the issue is with same mode and 6MHz Clockrate SPI write and read works properly and with 30MHz clockrate its not. Do you have any idea?


Thank you.
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 800
    • View Profile
Re: 30MHz SPI CLOCK Frequency in FT2232H mini module
« Reply #11 on: May 27, 2022, 02:41:34 PM »

Hi,

we have a new beta version of LibMPSSE that you can try. if you email in to support1@ftdichip.com i can tell you how to access the beta.

Best Regards

FTDI Community
Logged