The Fast Serial Interface (FSI) driver provides API to program the FSI module. FSI is a serial communication peripheral capable of reliable and robust high-speed communications. FSI is used to transfer/receive data frame with several available configurations e.g frame size, bandwidth etc, signaling events completion via interrupts or status registers.
Features Supported
- Supports programmable packet data length of 1-to-16 words where each word consists of 16-bits
- Supports programmable frame tagging (0000-to-1111) for message filtering
- Supports programmable data-lines( 1-or-2) for communication
- Supports Double Data Rate (DDR) communication
- Supports programmable interrupts via 2 interrupt lines per FSI core
Features NOT Supported
- DMA mode
- Multi-Slave configuration
- clkstop_req/ack functionality. Software must ensure that the FSI IP's on both host and remote device are idle before triggering clkstop_req.
SysConfig Features
- Note
- It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
- Selection of instances present in the device
- Configuring pinmux based on selected instance and pin configuration
Important Usage Guidelines
- Note: FSI-RX and FSI-TX are completely independent and separate module. For communication, both needs to be configured separately.
Example Usage
Include the below file to access the APIs
FSI tx config
int32_t status;
status = FSI_performTxInitialization(txBaseAddr, FSI_APP_TX_PRESCALER_VAL);
status += FSI_resetTxModule(txBaseAddr, FSI_TX_MASTER_CORE_RESET);
FSI_clearTxModuleReset(txBaseAddr, FSI_TX_MASTER_CORE_RESET);
status += FSI_setTxSoftwareFrameSize(txBaseAddr, FSI_APP_FRAME_DATA_WORD_SIZE);
status += FSI_setTxDataWidth(txBaseAddr, FSI_APP_N_LANES);
status += FSI_setTxUserDefinedData(txBaseAddr, FSI_APP_TX_USER_DATA);
status += FSI_setTxFrameTag(txBaseAddr, FSI_APP_TX_DATA_FRAME_TAG);
FSI rx config
int32_t status;
status = FSI_performRxInitialization(rxBaseAddr);
status += FSI_resetRxModule(rxBaseAddr, FSI_RX_MASTER_CORE_RESET);
FSI_clearRxModuleReset(rxBaseAddr, FSI_RX_MASTER_CORE_RESET);
status += FSI_setRxSoftwareFrameSize(rxBaseAddr, FSI_APP_FRAME_DATA_WORD_SIZE);
status += FSI_setRxDataWidth(rxBaseAddr, FSI_APP_N_LANES);
status += FSI_setRxBufferPtr(rxBaseAddr, 0U);
FSI configuration to enable interrupt
static void Fsi_appTxCallback(void *args)
{
uint32_t txBaseAddr = (uint32_t) args;
FSI_clearTxEvents(txBaseAddr, FSI_TX_EVT_FRAME_DONE);
return;
}
static void Fsi_appRxCallback(void *args)
{
uint32_t rxBaseAddr = (uint32_t) args;
FSI_clearRxEvents(rxBaseAddr, FSI_RX_EVT_DATA_FRAME);
return;
}
static int32_t Fsi_appIntrInit(uint32_t txBaseAddr, uint32_t rxBaseAddr)
{
int32_t status;
uint32_t txIntrNum, rxIntrNum;
txIntrNum = CONFIG_FSI_TX0_INTR1;
txHwiPrms.
args = (
void *) txBaseAddr;
status += FSI_enableTxInterrupt(txBaseAddr,
FSI_INT1, FSI_TX_EVT_FRAME_DONE);
rxIntrNum = CONFIG_FSI_RX0_INTR1;
rxHwiPrms.
args = (
void *) rxBaseAddr;
status += FSI_enableRxInterrupt(rxBaseAddr,
FSI_INT1, FSI_RX_EVT_DATA_FRAME);
return status;
}
static void Fsi_appIntrDeInit(uint32_t txBaseAddr, uint32_t rxBaseAddr)
{
FSI_disableTxInterrupt(txBaseAddr,
FSI_INT1, FSI_TX_EVTMASK);
FSI_clearTxEvents(txBaseAddr, FSI_TX_EVTMASK);
FSI_disableRxInterrupt(rxBaseAddr,
FSI_INT1, FSI_TX_EVTMASK);
FSI_clearRxEvents(rxBaseAddr, FSI_RX_EVTMASK);
return;
}
API
APIs for FSI