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: MatLab and libMPSSE SPI with FT232RL  (Read 819 times)

diabloi

  • Newbie
  • *
  • Posts: 3
    • View Profile
MatLab and libMPSSE SPI with FT232RL
« on: December 27, 2020, 09:39:58 PM »

Hello Community,

I have a few questions for you. I downloaded the MPSSE SPI library and install it without problems.  I have a project to complete with MatLab, I have a device from which I have to read the data (16bits) contained in it via the SPI interface. To do this I use an FT232RL as an interface between PC and device. Reading the D2XX Programmer's Guide, there are many examples, but not in MatLab.
How can I set CPOL=1 and CPHA=1? I don't understand this line of code.
Code: [Select]
ChConfig.configOptions = uint32(0); % Bit 1 is CPOL, bit 0 is CPHA.  Higher order bits configure the chip select.
This is how to sent the bits to device through FT232RL, but if I want to read the data? How can i write the code?
Code: [Select]
% Write to the SPI.
writebuffer = [15 14 13 ......... 2 1 0]; %for us it is 16 bit= 4bits address|1 Write bit| 9bits data|1 parity bit
transfer_options = 0; % No chip select used.
calllib(Libname,'SPI_Write',pChannelHandle,writebuffer,length(writebuffer),pNumBytesTransferred,transfer_options);



Logged