EasyManua.ls Logo

FTDI LibFT4222 - SPI Reset

Default Icon
78 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
44
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
Parameters:
ftHandle
Handle of the device.
spiIdx
The index of the SPI transaction, which ranges from 0~3 depending on the mode
of the chip. For example, under mode 0 and mode 3 as we mentioned in chapter
1.1, it should be 0 because there is only one SPI master or slave connection, and
so forth.
Return Value:
FT4222_OK if successful, otherwise the return value is an FT error code.
Error code:
FT4222_DEVICE_NOT_OPENED: The initialization API is not called.
FT4222_INVALID_PARAMETER: Parameter spiIdx is incorrect. It must depend on mode of chip.
Prerequisite:
FT4222_SPISlave_InitEx or FT4222_SPISlave_Init or FT4222_SPIMaster_Init
Example:
FT_HANDLE ftHandle = NULL;
FT_STATUS ftStatus;
FT4222_STATUS ft4222Status;
ftStatus = FT_OpenEx("FT4222 A",FT_OPEN_BY_DESCRIPTION, &ftHandle);
if (FT_OK != ftStatus)
{
// open failed
return;
}
if (FT4222_OK != FT4222_SPISlave_InitEx(ftHandle, SPI_SLAVE_NO_PROTOCOL))
{
// init spi slave failed
return;
}
//clear TX / RX cache
if (FT4222_OK != FT4222_SPI_ResetTransaction(ftHandle, 0))
{
// purge usb tx/rx and SPI FIFO cache
return;
}
// read/write data to a SPI slave
FT4222_UnInitialize(ftHandle);
FT_Close(ftHandle);
3.5.2 SPI Reset
FT4222_STATUS FT4222_SPI_Reset (FT_HANDLE ftHandle)
Supported Chip:
FT4222 chip version
Supported
FT4222 Rev A
YES
FT4222 Rev B
YES
FT4222 Rev C
YES
FT4222 Rev D
YES

Table of Contents