SPI communication from LabVIEW using FT4222

Home / Blogs / SPI communication from LabVIEW using FT4222

I’ve been recently asked to help out with some SPI communication support with FTDI FT4222 device.  For those who don’t have idea about this comm., it’s one of the famous inter-controller communication method.  The SPI comm. speed with FT4222 can go up to 53.8Mbps.  Really, it’s that much speed however you should have board designed for that much speed.

Here is a short story on how I did it.

I developed low-level LabVIEW drivers which essentially uses the LibFT422 DLL from FTDI.  The 4 important SPI comm., functions to be achieved are

  1. SPI Master Read
  2. SPI Master Write
  3. SPI Slave Read
  4. SPI Slave Write

After writing the low-level drivers in LabVIEW, I wanted to do the real testing. But to do the real testing, I don’t have access to the real hardware and I have to do away with other options.  It has stricken me that I can make use of my hobby electronic items to do this real project testing.  So, I used hobby items like

  • Arduino Uno board,
  • Saleae Logic Analyzer,
  • Few burg wires.

The easiest of those 4 functions is the SPI Master Write.  I can do the SPI Master Write with only UMFT4222ev EVM on hand and connect those SPI lines (MOSI, SCK, SS) to my hobby logic analyzer to check if I’m really getting the data I have written in LabVIEW.  Ooohlaa!  I got the same string I had written in LabVIEW.!

Next easier one is SPI Slave Write.  Similar to SPI Master Write, I just wanted to write some bytes in LabVIEW and check in logic analyzer whether I can receive the same bytes.  Here too, I got the same string I had written in LabVIEW.!

Next tricker one is SPI Slave Read.  For this, I wanted some master to keep sending the data so that I can read them back in my LabVIEW.  And, that’s the purpose of Arduino here.  I generated some texts in Arduino sketch and streamed those texts in it’s SPI Master.  I tried to read them with my low-level LabVIEW drivers.  Wow, I got them too..!  LabVIEW shows the text I generated in Arduino.

In FT4222, SPI Slave works in 3 modes viz

  1. Slave read With Protocol – Some extra bytes before and after payload data which gives the consistency in the data streaming.  Also handshaking between master and slave happens after receiving the packet.
  2. Slave read Without Protocol – Simple SPI comm. where you write only the data and read back the same data
  3. Slave read Without Acknowledgement – Same as with-protocol, but NO handshaking happens.

I have written LabVIEW low-level for all these modes.  However I written example VI for SPI Slave without-protocol, which I believe the easiest way for first time learners.  Also, since that the project required only without-protocol, I used without-protocol mode.  For with-protocol mode, FT4222 has a built in protocol decoder which I have not explored yet, but should be like I have to frame that protocol and send from the master.

I’m yet to do for SPI Master Read.. Awaiting..!

4 Comments

  • SK

    Hi Ajay,
    I develop a LabView program for using ft4222.
    I want to use ft4222 to slave.
    Would you give me your LabView program for me?

      • SK

        Thanks for applying.

        Now I’m developing a data acquisition program using Labview.

        I want to communicate my STM32 with PC using FT4222 by SPI.

        So, I consider buying your ft4222 driver.

        In my system, Ft4222 is slave and it receives 32byte every 500ms.

        Is your driver support this data rate?

        Best regards.

Leave a Reply to Ajay Cancel reply

Your email address will not be published. Required fields are marked *