AM261x MCU+ SDK: FSI

| AM261x MCU+ SDK 26.00.00 |

FSI

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
- Supports DMA mode. The DMA event will only be generated for data frames.
- Supports programmable TX delay line control

# Features NOT Supported

- Multi-Peripheral 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
- Interrupt Crossbar configuration for FSI RX and TX.

# Important Usage Guidelines

- Note: FSI-RX and FSI-TX are completely independent and separate module. For communication, both needs to be configured separately.
- Interrupt Crossbar configuration should be done to route FSI RX and TX interrupts if SysCfg is not used.

# Example Usage

Include the below file to access the APIs

#include <drivers/fsi.h>

FSI tx config

int32_t status;
/* TX init and reset */
status = FSI_performTxInitialization(txBaseAddr, FSI_APP_TX_PRESCALER_VAL);
status += FSI_resetTxModule(txBaseAddr, FSI_TX_MAIN_CORE_RESET);
FSI_clearTxModuleReset(txBaseAddr, FSI_TX_MAIN_CORE_RESET);
/* Setting for requested transfer params */
status += FSI_setTxSoftwareFrameSize(txBaseAddr, FSI_APP_FRAME_DATA_WORD_SIZE);
status += FSI_setTxDataWidth(txBaseAddr, FSI_APP_N_LANES);
/* Setting frame config */
status += FSI_setTxUserDefinedData(txBaseAddr, FSI_APP_TX_USER_DATA);
status += FSI_setTxFrameTag(txBaseAddr, FSI_APP_TX_DATA_FRAME_TAG);
status += FSI_setTxFrameType(txBaseAddr, FSI_FRAME_TYPE_NWORD_DATA);

FSI rx config

int32_t status;
/* RX init and reset */
status = FSI_performRxInitialization(rxBaseAddr);
status += FSI_resetRxModule(rxBaseAddr, FSI_RX_MAIN_CORE_RESET);
FSI_clearRxModuleReset(rxBaseAddr, FSI_RX_MAIN_CORE_RESET);
/* Setting for requested transfer params */
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);
SemaphoreP_post(&gFsiTxSemObject);
/*
** Handle tx callback function here
*/
return;
}
static void Fsi_appRxCallback(void *args)
{
uint32_t rxBaseAddr = (uint32_t) args;
FSI_clearRxEvents(rxBaseAddr, FSI_RX_EVT_DATA_FRAME);
SemaphoreP_post(&gFsiRxSemObject);
/*
** Handle rx callback function here
*/
return;
}
static int32_t Fsi_appIntrInit(uint32_t txBaseAddr, uint32_t rxBaseAddr)
{
int32_t status;
uint32_t txIntrNum, rxIntrNum;
HwiP_Params txHwiPrms, rxHwiPrms;
/*
* TX interrupt config and registration
*/
txIntrNum = CONFIG_FSI_TX0_INTR1;
status = SemaphoreP_constructBinary(&gFsiTxSemObject, 0);
DebugP_assert(SystemP_SUCCESS == status);
HwiP_Params_init(&txHwiPrms);
txHwiPrms.intNum = txIntrNum;
txHwiPrms.callback = Fsi_appTxCallback;
txHwiPrms.args = (void *) txBaseAddr;
HwiP_construct(&gFsiTxHwiObject, &txHwiPrms);
DebugP_assert(status == SystemP_SUCCESS);
/* Enable TX frame done interrupt */
status += FSI_enableTxInterrupt(txBaseAddr, FSI_INT1, FSI_TX_EVT_FRAME_DONE);
/*
* RX interrupt config and registration
*/
rxIntrNum = CONFIG_FSI_RX0_INTR1;
status = SemaphoreP_constructBinary(&gFsiRxSemObject, 0);
DebugP_assert(SystemP_SUCCESS == status);
HwiP_Params_init(&rxHwiPrms);
rxHwiPrms.intNum = rxIntrNum;
rxHwiPrms.callback = Fsi_appRxCallback;
rxHwiPrms.args = (void *) rxBaseAddr;
HwiP_construct(&gFsiRxHwiObject, &rxHwiPrms);
DebugP_assert(status == SystemP_SUCCESS);
/* Enable RX frame done interrupt */
status += FSI_enableRxInterrupt(rxBaseAddr, FSI_INT1, FSI_RX_EVT_DATA_FRAME);
return status;
}
static void Fsi_appIntrDeInit(uint32_t txBaseAddr, uint32_t rxBaseAddr)
{
/* TX interrupt deinit */
FSI_disableTxInterrupt(txBaseAddr, FSI_INT1, FSI_TX_EVTMASK);
FSI_clearTxEvents(txBaseAddr, FSI_TX_EVTMASK);
HwiP_destruct(&gFsiTxHwiObject);
SemaphoreP_destruct(&gFsiTxSemObject);
/* RX interrupt deinit */
FSI_disableRxInterrupt(rxBaseAddr, FSI_INT1, FSI_TX_EVTMASK);
FSI_clearRxEvents(rxBaseAddr, FSI_RX_EVTMASK);
HwiP_destruct(&gFsiRxHwiObject);
SemaphoreP_destruct(&gFsiRxSemObject);
return;
}

# API

APIs for FSI

FSI_setRxSoftwareFrameSize
int32_t FSI_setRxSoftwareFrameSize(uint32_t base, uint16_t nWords)
This API sets the RX frame size if frame type is user/software defined frame.
fsi.h
args
void * args
Definition: hsmclient_msg.h:4
FSI_setRxBufferPtr
int32_t FSI_setRxBufferPtr(uint32_t base, uint16_t bufPtrOff)
This API sets the value for receive buffer pointer at desired location.
FSI_enableRxInterrupt
int32_t FSI_enableRxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags)
This API enables user to generate interrupt on occurrence of RX events.
HwiP_destruct
void HwiP_destruct(HwiP_Object *obj)
Cleanup, delete, destruct a Hwi object.
HwiP_Params
Parameters passed during HwiP_construct.
Definition: HwiP.h:127
FSI_INT1
#define FSI_INT1
Definition: fsi/v0/fsi.h:138
FSI_disableRxInterrupt
int32_t FSI_disableRxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags)
This API enables user to disable interrupt generation on RX events.
FSI_performRxInitialization
int32_t FSI_performRxInitialization(uint32_t base)
This API initializes FSI RX module.
FSI_clearRxEvents
int32_t FSI_clearRxEvents(uint32_t base, uint16_t evtFlags)
This API enables user to clear RX event/error flags.
HwiP_construct
int32_t HwiP_construct(HwiP_Object *obj, HwiP_Params *params)
Create a Hwi object.
FSI_clearTxEvents
int32_t FSI_clearTxEvents(uint32_t base, uint16_t evtFlags)
This API enables user to clear TX error flags.
FSI_setTxSoftwareFrameSize
int32_t FSI_setTxSoftwareFrameSize(uint32_t base, uint16_t nWords)
This API sets the frame size if frame type is user/software defined frame.
FSI_setTxFrameType
int32_t FSI_setTxFrameType(uint32_t base, FSI_FrameType frameType)
This API sets frame type for transmission.
HwiP_Params_init
void HwiP_Params_init(HwiP_Params *params)
Set default values to HwiP_Params.
FSI_TX_EVTMASK
#define FSI_TX_EVTMASK
Mask of all TX Event types.
Definition: fsi_tx.h:110
FSI_RX_EVT_DATA_FRAME
#define FSI_RX_EVT_DATA_FRAME
Definition: fsi_rx.h:119
FSI_RX_EVTMASK
#define FSI_RX_EVTMASK
Mask of all RX Events, ORing all event defines.
Definition: fsi_rx.h:125
FSI_FRAME_TYPE_NWORD_DATA
#define FSI_FRAME_TYPE_NWORD_DATA
Definition: fsi/v0/fsi.h:177
FSI_resetTxModule
int32_t FSI_resetTxModule(uint32_t base, FSI_TxSubmoduleInReset submodule)
This API resets clock or ping timeout counter or entire TX module.
FSI_performTxInitialization
int32_t FSI_performTxInitialization(uint32_t base, uint16_t prescalar)
This API initializes FSI TX module.
SemaphoreP_destruct
void SemaphoreP_destruct(SemaphoreP_Object *obj)
Cleanup, delete, destruct a semaphore object.
FSI_disableTxInterrupt
int32_t FSI_disableTxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags)
This API enables user to disable generation interrupt on occurrence of FSI TX events.
SystemP_SUCCESS
#define SystemP_SUCCESS
Return status when the API execution was successful.
Definition: SystemP.h:56
FSI_TX_MAIN_CORE_RESET
#define FSI_TX_MAIN_CORE_RESET
Definition: fsi_tx.h:133
FSI_setTxFrameTag
int32_t FSI_setTxFrameTag(uint32_t base, FSI_FrameTag frameTag)
This API sets frame tag for transmission.
FSI_resetRxModule
int32_t FSI_resetRxModule(uint32_t base, FSI_RxSubmoduleInReset submodule)
This API resets frame watchdog, ping watchdog or entire RX module.
FSI_setTxUserDefinedData
int32_t FSI_setTxUserDefinedData(uint32_t base, uint16_t userDefData)
This API sets user defined data for transmission It is an extra data field (8 bit) apart from regular...
HwiP_Params::callback
HwiP_FxnCallback callback
Definition: HwiP.h:130
FSI_enableTxInterrupt
int32_t FSI_enableTxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags)
This API enables user to generate interrupt on occurrence of FSI_TxEventList events.
FSI_clearRxModuleReset
int32_t FSI_clearRxModuleReset(uint32_t base, FSI_RxSubmoduleInReset submodule)
This API clears resets on frame watchdog, ping watchdog or entire RX module.
SemaphoreP_post
void SemaphoreP_post(SemaphoreP_Object *obj)
Post a semaphore object or unlock a mutex.
HwiP_Params::args
void * args
Definition: HwiP.h:131
FSI_setTxDataWidth
int32_t FSI_setTxDataWidth(uint32_t base, FSI_DataWidth dataWidth)
This API sets Data width for transmission.
SemaphoreP_constructBinary
int32_t SemaphoreP_constructBinary(SemaphoreP_Object *obj, uint32_t initValue)
Create a binary semaphore object.
FSI_RX_MAIN_CORE_RESET
#define FSI_RX_MAIN_CORE_RESET
Definition: fsi_rx.h:148
DebugP_assert
#define DebugP_assert(expression)
Function to call for assert check.
Definition: DebugP.h:187
HwiP_Params::intNum
uint32_t intNum
Definition: HwiP.h:129
FSI_clearTxModuleReset
int32_t FSI_clearTxModuleReset(uint32_t base, FSI_TxSubmoduleInReset submodule)
This API clears reset on clock or ping timeout counter or entire TX module.
FSI_TX_EVT_FRAME_DONE
#define FSI_TX_EVT_FRAME_DONE
Definition: fsi_tx.h:96
FSI_setRxDataWidth
int32_t FSI_setRxDataWidth(uint32_t base, FSI_DataWidth dataWidth)
This API selects number of data lines used for receiving.