General Category > Discussion - Software

How to use FT201X's GPIO with C#?

(1/1)

liquidair:
Hi FTDI,

I'm having a really hard time getting the GPIO to work on the FT201X. I've downloaded everything FT-X related and read it many times, I've successfully added the FTD2XX_NET.dll to my project and am able to connect to the device. This is my first experience with FTDI products, however, what is tripping me up more than anything is the documentation.

For one, the D2XX Programmer's Guide is based on C/C++, which wouldn't be a big deal, except the C# functions don't match. For instance, where' GetBitMode? It must be GetPinStates?

Then, there's nothing on how to actually use the GPIO. I finally found it in AN_373 Bit-Bang Modes for the FT-X Series, and there's examples. Sweet. So I try a simple example where I set CBUS3 output high, and then listen for a connected uC to drive CBUS0 high as an input. Doesn't work.

I debug for an hour and find that it GetPinStates for whatever reason appears to display the 1's compliment of what I expect (0b111111110 vs 0b00000001). Then after trying ~pinStates, and debugging for another hour cause that's returning 0 for some reason, I notice Visual Studio tell me that FTDI.FT_BIT_MODES.FT_BIT_MODE_CBUS_BITBANG  is only for the FT232. There's no mention of this anywhere in the documentation, and nor is there any documentation on how to actually use the 4 CBUS pins.

But there should be, the FT201 datasheet pg 11 mentions "A separate application note, AN232R-01, available from FTDI website (www.ftdichip.com) describes in more detail how to use CBUS bit bang mode." Clicking on this takes you to a broken link, and searching the site turns up a document not for the FT201.

Could someone please point me to documentation on how to use the FT201's GPIO. A programming guide for the C# driver would be a plus too!

Thank you.


FTDI Community:
Hello,

Section 4 of AN_373 covers CBUS bit bang examples for the FT-X series of ICs:
https://www.ftdichip.com/Support/Documents/AppNotes/AN_373%20Bit-Bang%20Modes%20for%20the%20FT-X%20Series.pdf

The Source code for the C# wrapper is available at the following:
https://www.ftdichip.com/Support/SoftwareExamples/CodeExamples/CSharp.htm
You can reference this for any function name differences, and can edit it if desired.

Best Regards,
FTDI Community

Navigation

[0] Message Index

Go to full version