The MCUXpresso SDK provides a peripheral driver for the Crossbar External Bus Interface (FlexBus) block of MCUXpresso SDK devices.
A multifunction external bus interface is provided on the device with a basic functionality to interface to slave-only devices. It can be directly connected to the following asynchronous or synchronous devices with little or no additional circuitry.
-
External ROMs
-
Flash memories
-
Programmable logic devices
-
Other simple target (slave) devices
For asynchronous devices, a simple chip-select based interface can be used. The FlexBus interface has up to six general purpose chip-selects, FB_CS[5:0]. The number of chip selects available depends on the device and its pin configuration.
FlexBus functional operation
To configure the FlexBus driver, use on of the two ways to configure the flexbus_config_t structure.
- Using the FLEXBUS_GetDefaultConfig() function.
- Set parameters in the flexbus_config_t structure.
To initialize and configure the FlexBus driver, call the FLEXBUS_Init() function and pass a pointer to the flexbus_config_t structure.
To de-initialize the FlexBus driver, call the FLEXBUS_Deinit() function.
Typical use case and example
This example shows how to write/read to external memory (MRAM) by using the FlexBus module.
|
enum | flexbus_port_size_t {
kFLEXBUS_4Bytes = 0x00U,
kFLEXBUS_1Byte = 0x01U,
kFLEXBUS_2Bytes = 0x02U
} |
| Defines port size for FlexBus peripheral. More...
|
|
enum | flexbus_write_address_hold_t {
kFLEXBUS_Hold1Cycle = 0x00U,
kFLEXBUS_Hold2Cycles = 0x01U,
kFLEXBUS_Hold3Cycles = 0x02U,
kFLEXBUS_Hold4Cycles = 0x03U
} |
| Defines number of cycles to hold address and attributes for FlexBus peripheral. More...
|
|
enum | flexbus_read_address_hold_t {
kFLEXBUS_Hold1Or0Cycles = 0x00U,
kFLEXBUS_Hold2Or1Cycles = 0x01U,
kFLEXBUS_Hold3Or2Cycle = 0x02U,
kFLEXBUS_Hold4Or3Cycle = 0x03U
} |
| Defines number of cycles to hold address and attributes for FlexBus peripheral. More...
|
|
enum | flexbus_address_setup_t {
kFLEXBUS_FirstRisingEdge = 0x00U,
kFLEXBUS_SecondRisingEdge = 0x01U,
kFLEXBUS_ThirdRisingEdge = 0x02U,
kFLEXBUS_FourthRisingEdge = 0x03U
} |
| Address setup for FlexBus peripheral. More...
|
|
enum | flexbus_bytelane_shift_t {
kFLEXBUS_NotShifted = 0x00U,
kFLEXBUS_Shifted = 0x01U
} |
| Defines byte-lane shift for FlexBus peripheral. More...
|
|
enum | flexbus_multiplex_group1_t {
kFLEXBUS_MultiplexGroup1_FB_ALE = 0x00U,
kFLEXBUS_MultiplexGroup1_FB_CS1 = 0x01U,
kFLEXBUS_MultiplexGroup1_FB_TS = 0x02U
} |
| Defines multiplex group1 valid signals. More...
|
|
enum | flexbus_multiplex_group2_t {
kFLEXBUS_MultiplexGroup2_FB_CS4 = 0x00U,
kFLEXBUS_MultiplexGroup2_FB_TSIZ0 = 0x01U,
kFLEXBUS_MultiplexGroup2_FB_BE_31_24 = 0x02U
} |
| Defines multiplex group2 valid signals. More...
|
|
enum | flexbus_multiplex_group3_t {
kFLEXBUS_MultiplexGroup3_FB_CS5 = 0x00U,
kFLEXBUS_MultiplexGroup3_FB_TSIZ1 = 0x01U,
kFLEXBUS_MultiplexGroup3_FB_BE_23_16 = 0x02U
} |
| Defines multiplex group3 valid signals. More...
|
|
enum | flexbus_multiplex_group4_t {
kFLEXBUS_MultiplexGroup4_FB_TBST = 0x00U,
kFLEXBUS_MultiplexGroup4_FB_CS2 = 0x01U,
kFLEXBUS_MultiplexGroup4_FB_BE_15_8 = 0x02U
} |
| Defines multiplex group4 valid signals. More...
|
|
enum | flexbus_multiplex_group5_t {
kFLEXBUS_MultiplexGroup5_FB_TA = 0x00U,
kFLEXBUS_MultiplexGroup5_FB_CS3 = 0x01U,
kFLEXBUS_MultiplexGroup5_FB_BE_7_0 = 0x02U
} |
| Defines multiplex group5 valid signals. More...
|
|
#define FSL_FLEXBUS_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
Enumerator |
---|
kFLEXBUS_4Bytes |
32-bit port size
|
kFLEXBUS_1Byte |
8-bit port size
|
kFLEXBUS_2Bytes |
16-bit port size
|
Enumerator |
---|
kFLEXBUS_Hold1Cycle |
Hold address and attributes one cycles after FB_CSn negates on writes.
|
kFLEXBUS_Hold2Cycles |
Hold address and attributes two cycles after FB_CSn negates on writes.
|
kFLEXBUS_Hold3Cycles |
Hold address and attributes three cycles after FB_CSn negates on writes.
|
kFLEXBUS_Hold4Cycles |
Hold address and attributes four cycles after FB_CSn negates on writes.
|
Enumerator |
---|
kFLEXBUS_Hold1Or0Cycles |
Hold address and attributes 1 or 0 cycles on reads.
|
kFLEXBUS_Hold2Or1Cycles |
Hold address and attributes 2 or 1 cycles on reads.
|
kFLEXBUS_Hold3Or2Cycle |
Hold address and attributes 3 or 2 cycles on reads.
|
kFLEXBUS_Hold4Or3Cycle |
Hold address and attributes 4 or 3 cycles on reads.
|
Enumerator |
---|
kFLEXBUS_FirstRisingEdge |
Assert FB_CSn on first rising clock edge after address is asserted.
|
kFLEXBUS_SecondRisingEdge |
Assert FB_CSn on second rising clock edge after address is asserted.
|
kFLEXBUS_ThirdRisingEdge |
Assert FB_CSn on third rising clock edge after address is asserted.
|
kFLEXBUS_FourthRisingEdge |
Assert FB_CSn on fourth rising clock edge after address is asserted.
|
Enumerator |
---|
kFLEXBUS_NotShifted |
Not shifted.
Data is left-justified on FB_AD
|
kFLEXBUS_Shifted |
Shifted.
Data is right justified on FB_AD
|
Enumerator |
---|
kFLEXBUS_MultiplexGroup1_FB_ALE |
FB_ALE.
|
kFLEXBUS_MultiplexGroup1_FB_CS1 |
FB_CS1.
|
kFLEXBUS_MultiplexGroup1_FB_TS |
FB_TS.
|
Enumerator |
---|
kFLEXBUS_MultiplexGroup2_FB_CS4 |
FB_CS4.
|
kFLEXBUS_MultiplexGroup2_FB_TSIZ0 |
FB_TSIZ0.
|
kFLEXBUS_MultiplexGroup2_FB_BE_31_24 |
FB_BE_31_24.
|
Enumerator |
---|
kFLEXBUS_MultiplexGroup3_FB_CS5 |
FB_CS5.
|
kFLEXBUS_MultiplexGroup3_FB_TSIZ1 |
FB_TSIZ1.
|
kFLEXBUS_MultiplexGroup3_FB_BE_23_16 |
FB_BE_23_16.
|
Enumerator |
---|
kFLEXBUS_MultiplexGroup4_FB_TBST |
FB_TBST.
|
kFLEXBUS_MultiplexGroup4_FB_CS2 |
FB_CS2.
|
kFLEXBUS_MultiplexGroup4_FB_BE_15_8 |
FB_BE_15_8.
|
Enumerator |
---|
kFLEXBUS_MultiplexGroup5_FB_TA |
FB_TA.
|
kFLEXBUS_MultiplexGroup5_FB_CS3 |
FB_CS3.
|
kFLEXBUS_MultiplexGroup5_FB_BE_7_0 |
FB_BE_7_0.
|
This function enables the clock gate for FlexBus module. Only chip 0 is validated and set to known values. Other chips are disabled. Note that in this function, certain parameters, depending on external memories, must be set before using the FLEXBUS_Init() function. This example shows how to set up the uart_state_t and the flexbus_config_t parameters and how to call the FLEXBUS_Init function by passing in these parameters.
- Parameters
-
base | FlexBus peripheral address. |
config | Pointer to the configuration structure |
void FLEXBUS_Deinit |
( |
FB_Type * |
base | ) |
|
This function disables the clock gate of the FlexBus module clock.
- Parameters
-
base | FlexBus peripheral address. |
This function initializes the FlexBus configuration structure to default value. The default values are.
fbConfig->chip = 0;
fbConfig->writeProtect = 0;
fbConfig->burstWrite = 0;
fbConfig->burstRead = 0;
fbConfig->byteEnableMode = 0;
fbConfig->autoAcknowledge = true;
fbConfig->extendTransferAddress = 0;
fbConfig->secondaryWaitStates = 0;
- Parameters
-
config | Pointer to the initialization structure. |
- See Also
- FLEXBUS_Init