Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
42
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
Prerequisite:
FT4222_SPISlave_InitEx or FT4222_SPISlave_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;
}
uint16 sizeTransferred = 0;
uint16 rxSize;
std::vector<unsigned char> sendData;
sendData.resize(3);
sendData[0] = 'a';
sendData[1] = 'b';
sendData[2] = 'c';
FT4222_SPISlave_Write(ftHandle, &sendData[0], sendData.size(), &sizeTransferred);
FT4222_UnInitialize(ftHandle);
FT_Close(ftHandle);
3.4.7 SPI Slave RX Response Time
FT4222_STATUS FT4222_SPISlave_RxQuickResponse(FT_HANDLE ftHandle, BOOL enable)
Supported Chip:
Summary:
Adjust SPI Slave RX response method. By default, RX quick-response function is off.
There are three rules that SPI Slave device returns the RX data to USB Host through USB PIPE.
Rule 1: SPI slave device does not receives USB maximum bulk size in specific time. The device
returns all rx data in device’s FIFO.
The specific time is defined by FT_SetLatencyTimer.
The full packet size , HS is 512 bytes, FS is 64 bytes. The device must response two
status bytes at every bulk-in packet. So the actual size, HS is 510 bytes, FS is 62
bytes. These two bytes are filled by device automatically and does not affect any
function. The user does not need to care about it.