FTDI Community

General Category => Discussion - Software => Topic started by: mattmcguinness on April 27, 2022, 03:13:40 PM

Title: Issues using FT260 to communicate over I2C
Post by: mattmcguinness on April 27, 2022, 03:13:40 PM
Hi everyone,

I'm currently trying to use an FT260S as a USB-I2C master to communicate with a couple of slaves. I'm trying to write the program in C# using the LibFT260 library and I'm using the AN438 code as an example but when the code tries to init and get the status I get errors.

Initialising the master gives an INCORRECT_CHIP_MODE
Getting the status gives an IO_ERROR - It returns 0 which I believe is busy?

Opening the device by VID is fine and when I call GetChipVersion(), I get "39846400" which looks like a valid version number.

Question 1 - Are these error codes documented anywhere?
Question 2 - What am I doing wrong? Is the chip wired up incorrectly? I have pull up resistors on the pins required for I2C comms is there anything else?

Thanks in advance
Title: Re: Issues using FT260 to communicate over I2C
Post by: FTDI Community on April 28, 2022, 04:51:07 PM
Hello Matt,

You can find the error codes in LibFT260.h which is included with LibFT260:

Code: [Select]
enum FT260_STATUS
{
                FT260_OK,
                FT260_INVALID_HANDLE,
                FT260_DEVICE_NOT_FOUND,
                FT260_DEVICE_NOT_OPENED,
                FT260_DEVICE_OPEN_FAIL,
                FT260_DEVICE_CLOSE_FAIL,
                FT260_INCORRECT_INTERFACE,
                FT260_INCORRECT_CHIP_MODE,
                FT260_DEVICE_MANAGER_ERROR,
                FT260_IO_ERROR,
                FT260_INVALID_PARAMETER,
                FT260_NULL_BUFFER_POINTER,
                FT260_BUFFER_SIZE_ERROR,
                FT260_UART_SET_FAIL,
                FT260_RX_NO_DATA,
                FT260_GPIO_WRONG_DIRECTION,
                FT260_INVALID_DEVICE,
                FT260_INVALID_OPEN_DRAIN_SET,
                FT260_INVALID_OPEN_DRAIN_RESET,
                FT260_I2C_READ_FAIL,
                FT260_OTHER_ERROR
};

If you are seeing FT260_INCORRECT_CHIP_MODE then check the hardware configuration.
See FT260 – Full speed HID Class USB to UART/I2C Datasheet (https://ftdichip.com/wp-content/uploads/2022/03/DS_FT260.pdf) section 5.1 Device Interface Configuration. DCNF0 and DCNF1 are configured on hardware.
Ensure you have I2C enabled and are opening the correct interface number.

IO_ERROR may also be a hardware issue. I would advise test, evaluation and reference using the UMFT260EV1A (https://ftdichip.com/products/umft260ev1a/) if you are already using custom hardware.

Also refer to the examples provided with LibFT260.

The other alternative is not to use LiBFT260 and access the device with raw HID commands. See AN_394 User Guide for FT260 (https://ftdichip.com/wp-content/uploads/2020/07/AN_394_User_Guide_for_FT260.pdf).

Best Regards,
FTDI Community