FTDI Community
General Category => Discussion - Drivers => Topic started by: rajat on February 22, 2022, 03:05:13 AM
-
I am a newbie to all this.
I am using FT232H as a USB to serial [ SCLK, SDI, SDO] converter.
In Win10 Home, I have used FTD2XX_NET and dotnet 6 framework and managed to talk to USB chip as per C#-example 3 on code examples section on the ftdi website.
I can read the Serial number, description from the USB chip.
However
- this examples does a UART loopback test so set baud rate etc UART related parameters.
I need a sample code which in C# which can set SPI parameters such as clock rate, 16bits/word and the do a block read ot 128 bytes.
Can you point my nose in the right direction.
Thanks in advance
Rajan
-
Hello,
To use I2C/SPI as a master, see AN_135 MPSSE Basics (https://ftdichip.com/wp-content/uploads/2020/08/AN_135_MPSSE_Basics.pdf) and our existing MPSSE Example projects:
https://ftdichip.com/software-examples/mpsse-projects/ (https://ftdichip.com/software-examples/mpsse-projects/)
There are two options to use I2C/SPI modes with the MPSSE engine:
a. Use LibMPSSE libraries. Example code is provided with the download.
b. Use D2XX drivers direct. Example code is shown at I2C (https://ftdichip.com/software-examples/mpsse-projects/#usb-to-i2c-inteface)/SPI (https://ftdichip.com/software-examples/mpsse-projects/#usb-to-spi-interface).
AN_108 Command Processor For MPSSE and MCU Host Bus Emulation Modes (https://ftdichip.com/wp-content/uploads/2020/08/AN_108_Command_Processor_for_MPSSE_and_MCU_Host_Bus_Emulation_Modes.pdf) provides the necessary information.
Option b is the best option to use the D2XX drivers direct (no dependency on libMPSSE library).
Unfortunately in option b above, we only have C++, Delphi and VB examples.
There is a C# example for I2C which you could use for reference.
We do have a C# wrapper which you could use to develop your own software:
https://ftdichip.com/software-examples/code-examples/csharp-examples/ (https://ftdichip.com/software-examples/code-examples/csharp-examples/)
Best Regards,
FTDI Community
-
Hello,
Thanks for the pointers in earlier post. I was able to talk to SPI Slave using libMPSSE and libftd2XX in Linux.
Seems I am going in the reverse direction and now want to take this to Windows.
Is there a libMPSSE_NET.dll ?
Thanks
Rajat
-
Hello,
Unfortunately we don't have libMPSSE_NET.dll or C# support for LibMPSSE.
The only option would be to use D2xx drivers direct.
You could take a look at AN_411 FTx232H MPSSE I2C Master Example in C Sharp (https://ftdichip.com/wp-content/uploads/2020/07/AN_411_FTx232H-MPSSE-I2C-Master-Example-in-Csharp.pdf).
This is for I2C not SPI but it might help you understand what is required.
Best Regards,
FTDI Community
-
Hi,
No worries.
It managed to get it working using VisualStudio IDE and a couple of header/library files ftd2xx.h, and libMPSSE_spi.h etc.
Almost the same code as in Linux executes fine in Windows.
Thanks
Rajat