MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
FLEXSPI FLASH Driver

Overview

Files

file  fsl_flexspi_nor_flash.h
 

Data Structures

struct  serial_nor_config_option_t
 Serial NOR configuration option. More...
 
struct  flexspi_lut_seq_t
 FLEXSPI LUT Sequence structure. More...
 
struct  flexspi_mem_config_t
 FLEXSPI Memory Configuration Block. More...
 
struct  flexspi_nor_config_t
 Serial NOR configuration block. More...
 
struct  flexspi_xfer_t
 FLEXSPI Transfer Context. More...
 

Macros

#define FLEXSPI_FEATURE_HAS_PARALLEL_MODE   0
 FLEXSPI Feature related definitions.
 
#define NOR_CMD_LUT_SEQ_IDX_READ   0U
 NOR LUT sequence index used for default LUT assignment NOTE: The will take effect if the lut sequences are not customized. More...
 
#define NOR_CMD_LUT_SEQ_IDX_READSTATUS   1U
 Read Status LUT sequence id in lookupTable stored in config block.
 
#define NOR_CMD_LUT_SEQ_IDX_READSTATUS_XPI   2U
 Read status DPI/QPI/OPI sequence id in lookupTable stored in config block.
 
#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE   3U
 Write Enable sequence id in lookupTable stored in config block.
 
#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE_XPI   4U
 Write Enable DPI/QPI/OPI sequence id in lookupTable stored in config block.
 
#define NOR_CMD_LUT_SEQ_IDX_ERASESECTOR   5U
 Erase Sector sequence id in lookupTable stored in config block.
 
#define NOR_CMD_LUT_SEQ_IDX_ERASEBLOCK   8U
 Erase Block sequence id in lookupTable stored in config block.
 
#define NOR_CMD_LUT_SEQ_IDX_PAGEPROGRAM   9U
 Program sequence id in lookupTable stored in config block.
 
#define NOR_CMD_LUT_SEQ_IDX_CHIPERASE   11U
 Chip Erase sequence in lookupTable id stored in config block.
 
#define NOR_CMD_LUT_SEQ_IDX_READ_SFDP   13U
 Read SFDP sequence in lookupTable id stored in config block.
 
#define NOR_CMD_LUT_SEQ_IDX_RESTORE_NOCMD   14U
 Restore 0-4-4/0-8-8 mode sequence id in lookupTable stored in config block.
 
#define NOR_CMD_LUT_SEQ_IDX_EXIT_NOCMD   15U
 Exit 0-4-4/0-8-8 mode sequence id in lookupTable stored in config blobk.
 

Enumerations

enum  _flexspi_status_groups {
  kStatusROMGroup_FLEXSPI = 60,
  kStatusROMGroup_FLEXSPINOR = 201
}
 FLEXSPI status group numbers. More...
 
enum  _flexspi_nor_status {
  kStatus_FLEXSPINOR_ProgramFail,
  kStatus_FLEXSPINOR_EraseSectorFail,
  kStatus_FLEXSPINOR_EraseAllFail = MAKE_STATUS(kStatusROMGroup_FLEXSPINOR, 2),
  kStatus_FLEXSPINOR_WaitTimeout = MAKE_STATUS(kStatusROMGroup_FLEXSPINOR, 3) ,
  kStatus_FlexSPINOR_WriteAlignmentError,
  kStatus_FlexSPINOR_CommandFailure,
  kStatus_FlexSPINOR_SFDP_NotFound = MAKE_STATUS(kStatusROMGroup_FLEXSPINOR, 7),
  kStatus_FLEXSPINOR_Unsupported_SFDP_Version,
  kStatus_FLEXSPINOR_Flash_NotFound,
  kStatus_FLEXSPINOR_DTRRead_DummyProbeFailed,
  kStatus_FLEXSPI_SequenceExecutionTimeout,
  kStatus_FLEXSPI_InvalidSequence = MAKE_STATUS(kStatusROMGroup_FLEXSPI, 1),
  kStatus_FLEXSPI_DeviceTimeout = MAKE_STATUS(kStatusROMGroup_FLEXSPI, 2)
}
 FLEXSPI NOR status. More...
 
enum  
 Configure the device_type of "serial_nor_config_option_t" structure.
 
enum  
 Configure the quad_mode_setting of "serial_nor_config_option_t" structure.
 
enum  
 FLEXSPI NOR Octal mode.
 
enum  
 miscellaneous mode
 
enum  
 FLEXSPI NOR reset logic options.
 
enum  
 Configure the flash_connection of "serial_nor_config_option_t" structure.
 
enum  
 FLEXSPI ROOT clock soruce related definitions.
 
enum  { , kRestoreSequence_Send_06_FF = 8U }
 Restore sequence options Configure the restore_sequence of "flash_run_context_t" structure. More...
 
enum  
 Port mode options.
 
enum  {
  kSerialFlash_ISSI_ManufacturerID = 0x9DU,
  kSerialFlash_Adesto_ManufacturerID = 0x1FU,
  kSerialFlash_Winbond_ManufacturerID = 0xEFU,
  kSerialFlash_Cypress_ManufacturerID = 0x01U
}
 Manufacturer ID. More...
 
enum  flexspi_operation_t {
  kFLEXSPIOperation_Command,
  kFLEXSPIOperation_Config,
  kFLEXSPIOperation_Write,
  kFLEXSPIOperation_Read
}
 
enum  flexspi_clock_type_t {
  kFlexSpiClock_CoreClock,
  kFlexSpiClock_AhbClock,
  kFlexSpiClock_SerialRootClock,
  kFlexSpiClock_IpgClock
}
 FLEXSPI Clock Type. More...
 

Functions

status_t FLEXSPI_NorFlash_Init (uint32_t instance, flexspi_nor_config_t *config)
 Initialize Serial NOR devices via FLEXSPI. More...
 
status_t FLEXSPI_NorFlash_ProgramPage (uint32_t instance, flexspi_nor_config_t *config, uint32_t dstAddr, const uint32_t *src)
 Program data to Serial NOR via FLEXSPI. More...
 
status_t FLEXSPI_NorFlash_EraseAll (uint32_t instance, flexspi_nor_config_t *config)
 Erase all the Serial NOR devices connected on FLEXSPI. More...
 
status_t FLEXSPI_NorFlash_EraseSector (uint32_t instance, flexspi_nor_config_t *config, uint32_t address)
 Erase one sector specified by address. More...
 
status_t FLEXSPI_NorFlash_Erase_Block (uint32_t instance, flexspi_nor_config_t *config, uint32_t address)
 Erase one block specified by address. More...
 
status_t FLEXSPI_NorFlash_GetConfig (uint32_t instance, flexspi_nor_config_t *config, serial_nor_config_option_t *option)
 Get FLEXSPI NOR Configuration Block based on specified option. More...
 
status_t FLEXSPI_NorFlash_Erase (uint32_t instance, flexspi_nor_config_t *config, uint32_t start, uint32_t length)
 Erase Flash Region specified by address and length. More...
 
status_t FLEXSPI_NorFlash_Read (uint32_t instance, flexspi_nor_config_t *config, uint32_t *dst, uint32_t start, uint32_t bytes)
 Read data from Serial NOR via FLEXSPI. More...
 
status_t FLEXSPI_NorFlash_CommandXfer (uint32_t instance, flexspi_xfer_t *xfer)
 FLEXSPI command. More...
 
status_t FLEXSPI_NorFlash_UpdateLut (uint32_t instance, uint32_t seqIndex, const uint32_t *lutBase, uint32_t seqNumber)
 Configure FLEXSPI Lookup table. More...
 
status_t FLEXSPI_NorFlash_SetClockSource (uint32_t clockSource)
 Set the clock source for FLEXSPI NOR. More...
 

Variables

uint32_t   serial_nor_config_option_t::max_freq: 4
 Maximum supported Frequency.
 
uint32_t   serial_nor_config_option_t::misc_mode: 4
 miscellaneous mode
 
uint32_t   serial_nor_config_option_t::quad_mode_setting: 4
 Quad mode setting.
 
uint32_t   serial_nor_config_option_t::cmd_pads: 4
 Command pads.
 
uint32_t   serial_nor_config_option_t::query_pads: 4
 SFDP read pads.
 
uint32_t   serial_nor_config_option_t::device_type: 4
 Device type.
 
uint32_t   serial_nor_config_option_t::option_size: 4
 Option size, in terms of uint32_t, size = (option_size + 1) * 4.
 
uint32_t   serial_nor_config_option_t::tag: 4
 Tag, must be 0x0E.
 
uint32_t   serial_nor_config_option_t::dummy_cycles: 8
 Dummy cycles before read.
 
uint32_t   serial_nor_config_option_t::status_override: 8
 Override status register value during device mode configuration.
 
uint32_t   serial_nor_config_option_t::pinmux_group: 4
 The pinmux group selection.
 
uint32_t   serial_nor_config_option_t::dqs_pinmux_group: 4
 The DQS Pinmux Group Selection.
 
uint32_t   serial_nor_config_option_t::drive_strength: 4
 The Drive Strength of FLEXSPI Pads.
 
uint32_t   serial_nor_config_option_t::flash_connection: 4
 Flash connection option: 0 - Single Flash connected to port A, 1 -. More...
 
uint8_t flexspi_lut_seq_t::seqNum
 Sequence Number, valid number: 1-16.
 
uint8_t flexspi_lut_seq_t::seqId
 Sequence Index, valid number: 0-15.
 
uint8_t flexspi_dll_time_t::time_100ps
 Data valid time, in terms of 100ps.
 
uint8_t flexspi_dll_time_t::delay_cells
 Data valid time, in terms of delay cells.
 
uint32_t flexspi_mem_config_t::tag
 [0x000-0x003] Tag, fixed value 0x42464346UL
 
uint32_t flexspi_mem_config_t::version
 [0x004-0x007] Version,[31:24] -'V', [23:16] - Major, [15:8] - Minor, [7:0] - bugfix
 
uint32_t flexspi_mem_config_t::reserved0
 [0x008-0x00b] Reserved for future use
 
uint8_t flexspi_mem_config_t::readSampleClkSrc
 [0x00c-0x00c] Read Sample Clock Source, valid value: 0/1/3
 
uint8_t flexspi_mem_config_t::csHoldTime
 [0x00d-0x00d] CS hold time, default value: 3
 
uint8_t flexspi_mem_config_t::csSetupTime
 [0x00e-0x00e] CS setup time, default value: 3
 
uint8_t flexspi_mem_config_t::columnAddressWidth
 [0x00f-0x00f] Column Address with, for HyperBus protocol, it is fixed to 3, For Serial NAND, need to refer to datasheet
 
uint8_t flexspi_mem_config_t::deviceModeCfgEnable
 [0x010-0x010] Device Mode Configure enable flag, 1 - Enable, 0 - Disable
 
uint8_t flexspi_mem_config_t::deviceModeType
 [0x011-0x011] Specify the configuration command type:Quad Enable, DPI/QPI/OPI switch, Generic configuration, etc. More...
 
uint16_t flexspi_mem_config_t::waitTimeCfgCommands
 [0x012-0x013] Wait time for all configuration commands, unit: 100us, Used for DPI/QPI/OPI switch or reset command
 
flexspi_lut_seq_t flexspi_mem_config_t::deviceModeSeq
 [0x014-0x017] Device mode sequence info, [7:0] - LUT sequence id, [15:8] - LUt sequence number, [31:16] Reserved
 
uint32_t flexspi_mem_config_t::deviceModeArg
 [0x018-0x01b] Argument/Parameter for device configuration
 
uint8_t flexspi_mem_config_t::configCmdEnable
 [0x01c-0x01c] Configure command Enable Flag, 1 - Enable, 0 - Disable
 
uint8_t flexspi_mem_config_t::configModeType [3]
 [0x01d-0x01f] Configure Mode Type, similar as deviceModeTpe
 
flexspi_lut_seq_t flexspi_mem_config_t::configCmdSeqs [3]
 [0x020-0x02b] Sequence info for Device Configuration command, similar as deviceModeSeq
 
uint32_t flexspi_mem_config_t::reserved1
 [0x02c-0x02f] Reserved for future use
 
uint32_t flexspi_mem_config_t::configCmdArgs [3]
 [0x030-0x03b] Arguments/Parameters for device Configuration commands
 
uint32_t flexspi_mem_config_t::reserved2
 [0x03c-0x03f] Reserved for future use
 
uint32_t flexspi_mem_config_t::controllerMiscOption
 [0x040-0x043] Controller Misc Options, see Misc feature bit definitions for more details
 
uint8_t flexspi_mem_config_t::deviceType
 [0x044-0x044] Device Type: See Flash Type Definition for more details
 
uint8_t flexspi_mem_config_t::sflashPadType
 [0x045-0x045] Serial Flash Pad Type: 1 - Single, 2 - Dual, 4 - Quad, 8 - Octal
 
uint8_t flexspi_mem_config_t::serialClkFreq
 [0x046-0x046] Serial Flash Frequencey, device specific definitions, See System Boot Chapter for more details
 
uint8_t flexspi_mem_config_t::lutCustomSeqEnable
 [0x047-0x047] LUT customization Enable, it is required if the program/erase cannot be done using 1 LUT sequence, currently, only applicable to HyperFLASH
 
uint32_t flexspi_mem_config_t::reserved3 [2]
 [0x048-0x04f] Reserved for future use
 
uint32_t flexspi_mem_config_t::sflashA1Size
 [0x050-0x053] Size of Flash connected to A1
 
uint32_t flexspi_mem_config_t::sflashA2Size
 [0x054-0x057] Size of Flash connected to A2
 
uint32_t flexspi_mem_config_t::sflashB1Size
 [0x058-0x05b] Size of Flash connected to B1
 
uint32_t flexspi_mem_config_t::sflashB2Size
 [0x05c-0x05f] Size of Flash connected to B2
 
uint32_t flexspi_mem_config_t::csPadSettingOverride
 [0x060-0x063] CS pad setting override value
 
uint32_t flexspi_mem_config_t::sclkPadSettingOverride
 [0x064-0x067] SCK pad setting override value
 
uint32_t flexspi_mem_config_t::dataPadSettingOverride
 [0x068-0x06b] data pad setting override value
 
uint32_t flexspi_mem_config_t::dqsPadSettingOverride
 [0x06c-0x06f] DQS pad setting override value
 
uint32_t flexspi_mem_config_t::timeoutInMs
 [0x070-0x073] Timeout threshold for read status command
 
uint32_t flexspi_mem_config_t::commandInterval
 [0x074-0x077] CS deselect interval between two commands
 
flexspi_dll_time_t flexspi_mem_config_t::dataValidTime [2]
 [0x078-0x07b] CLK edge to data valid time for PORT A and PORT B
 
uint16_t flexspi_mem_config_t::busyOffset
 [0x07c-0x07d] Busy offset, valid value: 0-31
 
uint16_t flexspi_mem_config_t::busyBitPolarity
 [0x07e-0x07f] Busy flag polarity, 0 - busy flag is 1 when flash device is busy, 1 - busy flag is 0 when flash device is busy
 
uint32_t flexspi_mem_config_t::lookupTable [64]
 [0x080-0x17f] Lookup table holds Flash command sequences
 
flexspi_lut_seq_t flexspi_mem_config_t::lutCustomSeq [12]
 [0x180-0x1af] Customizable LUT Sequences
 
uint32_t flexspi_mem_config_t::dll1CrVal
 

[0x1b0-0x1b3] Customizable DLL0CR setting */


 
uint32_t flexspi_mem_config_t::reserved4 [2]
 

[0x1b4-0x1b7] Customizable DLL1CR setting */

More...
 
flexspi_mem_config_t flexspi_nor_config_t::memConfig
 Common memory configuration info via FLEXSPI.
 
uint32_t flexspi_nor_config_t::pageSize
 Page size of Serial NOR.
 
uint32_t flexspi_nor_config_t::sectorSize
 Sector size of Serial NOR.
 
uint8_t flexspi_nor_config_t::ipcmdSerialClkFreq
 Clock frequency for IP command.
 
uint8_t flexspi_nor_config_t::isUniformBlockSize
 Sector/Block size is the same.
 
uint8_t flexspi_nor_config_t::isDataOrderSwapped
 Data order (D0, D1, D2, D3) is swapped (D1,D0, D3, D2)
 
uint8_t flexspi_nor_config_t::reserved0 [1]
 Reserved for future use.
 
uint8_t flexspi_nor_config_t::serialNorType
 Serial NOR Flash type: 0/1/2/3.
 
uint8_t flexspi_nor_config_t::needExitNoCmdMode
 Need to exit NoCmd mode before other IP command.
 
uint8_t flexspi_nor_config_t::halfClkForNonReadCmd
 Half the Serial Clock for non-read command: true/false.
 
uint8_t flexspi_nor_config_t::needRestoreNoCmdMode
 Need to Restore NoCmd mode after IP commmand execution.
 
uint32_t flexspi_nor_config_t::blockSize
 Block size.
 
uint32_t flexspi_nor_config_t::flashStateCtx
 Flash State Context.
 
uint32_t flexspi_nor_config_t::reserve2 [10]
 Reserved for future use.
 
flexspi_operation_t flexspi_xfer_t::operation
 FLEXSPI operation.
 
uint32_t flexspi_xfer_t::baseAddress
 FLEXSPI operation base address.
 
uint32_t flexspi_xfer_t::seqId
 Sequence Id.
 
uint32_t flexspi_xfer_t::seqNum
 Sequence Number.
 
bool flexspi_xfer_t::isParallelModeEnable
 Is a parallel transfer.
 
uint32_t * flexspi_xfer_t::txBuffer
 Tx buffer.
 
uint32_t flexspi_xfer_t::txSize
 Tx size in bytes.
 
uint32_t * flexspi_xfer_t::rxBuffer
 Rx buffer.
 
uint32_t flexspi_xfer_t::rxSize
 Rx size in bytes.
 

Support for init FLEXSPI NOR configuration

enum  
 Flash Pad Definitions.
 
enum  {
  kFLEXSPIClk_SDR,
  kFLEXSPIClk_DDR
}
 FLEXSPI clock configuration type. More...
 
enum  _flexspi_read_sample_clk
 FLEXSPI Read Sample Clock Source definition.
 
enum  { kFLEXSPIDeviceType_SerialNOR = 1U }
 Flash Type Definition. More...
 
enum  {
  kDeviceConfigCmdType_Generic,
  kDeviceConfigCmdType_QuadEnable,
  kDeviceConfigCmdType_Spi2Xpi,
  kDeviceConfigCmdType_Xpi2Spi,
  kDeviceConfigCmdType_Spi2NoCmd,
  kDeviceConfigCmdType_Reset
}
 Flash Configuration Command Type. More...
 
enum  _flexspi_serial_clk_freq
 Defintions for FLEXSPI Serial Clock Frequency.
 
enum  {
  kFLEXSPIMiscOffset_DiffClkEnable = 0U,
  kFLEXSPIMiscOffset_Ck2Enable = 1U,
  kFLEXSPIMiscOffset_ParallelEnable = 2U,
  kFLEXSPIMiscOffset_WordAddressableEnable = 3U,
  kFLEXSPIMiscOffset_SafeConfigFreqEnable = 4U,
  kFLEXSPIMiscOffset_PadSettingOverrideEnable = 5U,
  kFLEXSPIMiscOffset_DdrModeEnable = 6U,
  kFLEXSPIMiscOffset_UseValidTimeForAllFreq = 7U
}
 Misc feature bit definitions. More...
 

Data Structure Documentation

struct serial_nor_config_option_t
struct flexspi_lut_seq_t

Data Fields

uint8_t seqNum
 Sequence Number, valid number: 1-16.
 
uint8_t seqId
 Sequence Index, valid number: 0-15.
 
struct flexspi_mem_config_t

Data Fields

uint32_t tag
 [0x000-0x003] Tag, fixed value 0x42464346UL
 
uint32_t version
 [0x004-0x007] Version,[31:24] -'V', [23:16] - Major, [15:8] - Minor, [7:0] - bugfix
 
uint32_t reserved0
 [0x008-0x00b] Reserved for future use
 
uint8_t readSampleClkSrc
 [0x00c-0x00c] Read Sample Clock Source, valid value: 0/1/3
 
uint8_t csHoldTime
 [0x00d-0x00d] CS hold time, default value: 3
 
uint8_t csSetupTime
 [0x00e-0x00e] CS setup time, default value: 3
 
uint8_t columnAddressWidth
 [0x00f-0x00f] Column Address with, for HyperBus protocol, it is fixed to 3, For Serial NAND, need to refer to datasheet
 
uint8_t deviceModeCfgEnable
 [0x010-0x010] Device Mode Configure enable flag, 1 - Enable, 0 - Disable
 
uint8_t deviceModeType
 [0x011-0x011] Specify the configuration command type:Quad Enable, DPI/QPI/OPI switch, Generic configuration, etc. More...
 
uint16_t waitTimeCfgCommands
 [0x012-0x013] Wait time for all configuration commands, unit: 100us, Used for DPI/QPI/OPI switch or reset command
 
flexspi_lut_seq_t deviceModeSeq
 [0x014-0x017] Device mode sequence info, [7:0] - LUT sequence id, [15:8] - LUt sequence number, [31:16] Reserved
 
uint32_t deviceModeArg
 [0x018-0x01b] Argument/Parameter for device configuration
 
uint8_t configCmdEnable
 [0x01c-0x01c] Configure command Enable Flag, 1 - Enable, 0 - Disable
 
uint8_t configModeType [3]
 [0x01d-0x01f] Configure Mode Type, similar as deviceModeTpe
 
flexspi_lut_seq_t configCmdSeqs [3]
 [0x020-0x02b] Sequence info for Device Configuration command, similar as deviceModeSeq
 
uint32_t reserved1
 [0x02c-0x02f] Reserved for future use
 
uint32_t configCmdArgs [3]
 [0x030-0x03b] Arguments/Parameters for device Configuration commands
 
uint32_t reserved2
 [0x03c-0x03f] Reserved for future use
 
uint32_t controllerMiscOption
 [0x040-0x043] Controller Misc Options, see Misc feature bit definitions for more details
 
uint8_t deviceType
 [0x044-0x044] Device Type: See Flash Type Definition for more details
 
uint8_t sflashPadType
 [0x045-0x045] Serial Flash Pad Type: 1 - Single, 2 - Dual, 4 - Quad, 8 - Octal
 
uint8_t serialClkFreq
 [0x046-0x046] Serial Flash Frequencey, device specific definitions, See System Boot Chapter for more details
 
uint8_t lutCustomSeqEnable
 [0x047-0x047] LUT customization Enable, it is required if the program/erase cannot be done using 1 LUT sequence, currently, only applicable to HyperFLASH
 
uint32_t reserved3 [2]
 [0x048-0x04f] Reserved for future use
 
uint32_t sflashA1Size
 [0x050-0x053] Size of Flash connected to A1
 
uint32_t sflashA2Size
 [0x054-0x057] Size of Flash connected to A2
 
uint32_t sflashB1Size
 [0x058-0x05b] Size of Flash connected to B1
 
uint32_t sflashB2Size
 [0x05c-0x05f] Size of Flash connected to B2
 
uint32_t csPadSettingOverride
 [0x060-0x063] CS pad setting override value
 
uint32_t sclkPadSettingOverride
 [0x064-0x067] SCK pad setting override value
 
uint32_t dataPadSettingOverride
 [0x068-0x06b] data pad setting override value
 
uint32_t dqsPadSettingOverride
 [0x06c-0x06f] DQS pad setting override value
 
uint32_t timeoutInMs
 [0x070-0x073] Timeout threshold for read status command
 
uint32_t commandInterval
 [0x074-0x077] CS deselect interval between two commands
 
flexspi_dll_time_t dataValidTime [2]
 [0x078-0x07b] CLK edge to data valid time for PORT A and PORT B
 
uint16_t busyOffset
 [0x07c-0x07d] Busy offset, valid value: 0-31
 
uint16_t busyBitPolarity
 [0x07e-0x07f] Busy flag polarity, 0 - busy flag is 1 when flash device is busy, 1 - busy flag is 0 when flash device is busy
 
uint32_t lookupTable [64]
 [0x080-0x17f] Lookup table holds Flash command sequences
 
flexspi_lut_seq_t lutCustomSeq [12]
 [0x180-0x1af] Customizable LUT Sequences
 
uint32_t dll1CrVal
 

[0x1b0-0x1b3] Customizable DLL0CR setting */


 
uint32_t reserved4 [2]
 

[0x1b4-0x1b7] Customizable DLL1CR setting */

More...
 
struct flexspi_nor_config_t

Data Fields

flexspi_mem_config_t memConfig
 Common memory configuration info via FLEXSPI.
 
uint32_t pageSize
 Page size of Serial NOR.
 
uint32_t sectorSize
 Sector size of Serial NOR.
 
uint8_t ipcmdSerialClkFreq
 Clock frequency for IP command.
 
uint8_t isUniformBlockSize
 Sector/Block size is the same.
 
uint8_t isDataOrderSwapped
 Data order (D0, D1, D2, D3) is swapped (D1,D0, D3, D2)
 
uint8_t reserved0 [1]
 Reserved for future use.
 
uint8_t serialNorType
 Serial NOR Flash type: 0/1/2/3.
 
uint8_t needExitNoCmdMode
 Need to exit NoCmd mode before other IP command.
 
uint8_t halfClkForNonReadCmd
 Half the Serial Clock for non-read command: true/false.
 
uint8_t needRestoreNoCmdMode
 Need to Restore NoCmd mode after IP commmand execution.
 
uint32_t blockSize
 Block size.
 
uint32_t flashStateCtx
 Flash State Context.
 
uint32_t reserve2 [10]
 Reserved for future use.
 
struct flexspi_xfer_t

Data Fields

flexspi_operation_t operation
 FLEXSPI operation.
 
uint32_t baseAddress
 FLEXSPI operation base address.
 
uint32_t seqId
 Sequence Id.
 
uint32_t seqNum
 Sequence Number.
 
bool isParallelModeEnable
 Is a parallel transfer.
 
uint32_t * txBuffer
 Tx buffer.
 
uint32_t txSize
 Tx size in bytes.
 
uint32_t * rxBuffer
 Rx buffer.
 
uint32_t rxSize
 Rx size in bytes.
 

Macro Definition Documentation

#define NOR_CMD_LUT_SEQ_IDX_READ   0U

READ LUT sequence id in lookupTable stored in config block

Enumeration Type Documentation

Enumerator
kStatusROMGroup_FLEXSPI 

Group number for ROM FLEXSPI status codes.

kStatusROMGroup_FLEXSPINOR 

ROM FLEXSPI NOR status group number.

Enumerator
kStatus_FLEXSPINOR_ProgramFail 

Status for Page programming failure.

kStatus_FLEXSPINOR_EraseSectorFail 

Status for Sector Erase failure.

kStatus_FLEXSPINOR_EraseAllFail 

Status for Chip Erase failure.

kStatus_FLEXSPINOR_WaitTimeout 

Status for timeout.

kStatus_FlexSPINOR_WriteAlignmentError 

Status for Alignement error.

kStatus_FlexSPINOR_CommandFailure 

Status for Erase/Program Verify Error.

kStatus_FlexSPINOR_SFDP_NotFound 

Status for SFDP read failure.

kStatus_FLEXSPINOR_Unsupported_SFDP_Version 

Status for Unrecognized SFDP version.

kStatus_FLEXSPINOR_Flash_NotFound 

Status for Flash detection failure.

kStatus_FLEXSPINOR_DTRRead_DummyProbeFailed 

Status for DDR Read dummy probe failure.

kStatus_FLEXSPI_SequenceExecutionTimeout 

Status for Sequence Execution timeout.

kStatus_FLEXSPI_InvalidSequence 

Status for Invalid Sequence.

kStatus_FLEXSPI_DeviceTimeout 

Status for Device timeout.

anonymous enum
Enumerator
kRestoreSequence_Send_06_FF 

Adesto EcoXIP.

anonymous enum
Enumerator
kFLEXSPIClk_SDR 

Clock configure for SDR mode.

kFLEXSPIClk_DDR 

Clock configurat for DDR mode.

anonymous enum
Enumerator
kFLEXSPIDeviceType_SerialNOR 

Flash device is Serial NOR.

anonymous enum
Enumerator
kDeviceConfigCmdType_Generic 

Generic command, for example: configure dummy cycles, drive strength, etc.

kDeviceConfigCmdType_QuadEnable 

Quad Enable command.

kDeviceConfigCmdType_Spi2Xpi 

Switch from SPI to DPI/QPI/OPI mode.

kDeviceConfigCmdType_Xpi2Spi 

Switch from DPI/QPI/OPI to SPI mode.

kDeviceConfigCmdType_Spi2NoCmd 

Switch to 0-4-4/0-8-8 mode.

kDeviceConfigCmdType_Reset 

Reset device command.

anonymous enum
Enumerator
kFLEXSPIMiscOffset_DiffClkEnable 

Bit for Differential clock enable.

kFLEXSPIMiscOffset_Ck2Enable 

Bit for CK2 enable.

kFLEXSPIMiscOffset_ParallelEnable 

Bit for Parallel mode enable.

kFLEXSPIMiscOffset_WordAddressableEnable 

Bit for Word Addressable enable.

kFLEXSPIMiscOffset_SafeConfigFreqEnable 

Bit for Safe Configuration Frequency enable.

kFLEXSPIMiscOffset_PadSettingOverrideEnable 

Bit for Pad setting override enable.

kFLEXSPIMiscOffset_DdrModeEnable 

Bit for DDR clock confiuration indication.

kFLEXSPIMiscOffset_UseValidTimeForAllFreq 

Bit for DLLCR settings under all modes.

anonymous enum
Enumerator
kSerialFlash_ISSI_ManufacturerID 

Manufacturer ID of the ISSI serial flash.

kSerialFlash_Adesto_ManufacturerID 

Manufacturer ID of the Adesto Technologies serial flash.

kSerialFlash_Winbond_ManufacturerID 

Manufacturer ID of the Winbond serial flash.

kSerialFlash_Cypress_ManufacturerID 

Manufacturer ID for Cypress.

Enumerator
kFLEXSPIOperation_Command 

FLEXSPI operation: Only command, both TX and RX buffer are ignored.

kFLEXSPIOperation_Config 

FLEXSPI operation: Configure device mode, the TX FIFO size is fixed in LUT.

kFLEXSPIOperation_Write 

FLEXSPI operation: Write, only TX buffer is effective.

kFLEXSPIOperation_Read 

FLEXSPI operation: Read, only Rx Buffer is effective.

Enumerator
kFlexSpiClock_CoreClock 

ARM Core Clock.

kFlexSpiClock_AhbClock 

AHB clock.

kFlexSpiClock_SerialRootClock 

Serial Root Clock.

kFlexSpiClock_IpgClock 

IPG clock.

Function Documentation

status_t FLEXSPI_NorFlash_Init ( uint32_t  instance,
flexspi_nor_config_t config 
)

This function checks and initializes the FLEXSPI module for the other FLEXSPI APIs.

Parameters
instancestorage the instance of FLEXSPI.
configA pointer to the storage for the driver runtime state.
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentA invalid argument is provided.
kStatus_FLEXSPI_InvalidSequenceA invalid Sequence is provided.
kStatus_FLEXSPI_SequenceExecutionTimeoutSequence Execution timeout.
kStatus_FLEXSPI_DeviceTimeoutthe device timeout
status_t FLEXSPI_NorFlash_ProgramPage ( uint32_t  instance,
flexspi_nor_config_t config,
uint32_t  dstAddr,
const uint32_t *  src 
)

This function programs the NOR flash memory with the dest address for a given flash area as determined by the dst address and the length.

Parameters
instancestorage the instance of FLEXSPI.
configA pointer to the storage for the driver runtime state.
dst_addrA pointer to the desired flash memory to be programmed. NOTE: It is recommended that use page aligned access; If the dst_addr is not aligned to page,the driver automatically aligns address down with the page address.
srcA pointer to the source buffer of data that is to be programmed into the NOR flash.
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentA invalid argument is provided.
kStatus_FLEXSPI_InvalidSequenceA invalid Sequence is provided.
kStatus_FLEXSPI_SequenceExecutionTimeoutSequence Execution timeout.
kStatus_FLEXSPI_DeviceTimeoutthe device timeout
status_t FLEXSPI_NorFlash_EraseAll ( uint32_t  instance,
flexspi_nor_config_t config 
)
Parameters
instancestorage the instance of FLEXSPI.
configA pointer to the storage for the driver runtime state.
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentA invalid argument is provided.
kStatus_FLEXSPI_InvalidSequenceA invalid Sequence is provided.
kStatus_FLEXSPI_SequenceExecutionTimeoutSequence Execution timeout.
kStatus_FLEXSPI_DeviceTimeoutthe device timeout
status_t FLEXSPI_NorFlash_EraseSector ( uint32_t  instance,
flexspi_nor_config_t config,
uint32_t  address 
)

This function erases one of NOR flash sectors based on the desired address.

Parameters
instancestorage the index of FLEXSPI.
configA pointer to the storage for the driver runtime state.
addressThe start address of the desired NOR flash memory to be erased. NOTE: It is recommended that use sector-aligned access nor device; If dstAddr is not aligned with the sector,The driver automatically aligns address down with the sector address.
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentA invalid argument is provided.
kStatus_FLEXSPI_InvalidSequenceA invalid Sequence is provided.
kStatus_FLEXSPI_SequenceExecutionTimeoutSequence Execution timeout.
kStatus_FLEXSPI_DeviceTimeoutthe device timeout
status_t FLEXSPI_NorFlash_Erase_Block ( uint32_t  instance,
flexspi_nor_config_t config,
uint32_t  address 
)

This function erases one block of NOR flash based on the desired address.

Parameters
instancestorage the index of FLEXSPI.
configA pointer to the storage for the driver runtime state.
startThe start address of the desired NOR flash memory to be erased. NOTE: It is recommended that use block-aligned access nor device; If dstAddr is not aligned with the block,The driver automatically aligns address down with the block address.
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentA invalid argument is provided.
kStatus_FLEXSPI_InvalidSequenceA invalid Sequence is provided.
kStatus_FLEXSPI_SequenceExecutionTimeoutSequence Execution timeout.
kStatus_FLEXSPI_DeviceTimeoutthe device timeout
status_t FLEXSPI_NorFlash_GetConfig ( uint32_t  instance,
flexspi_nor_config_t config,
serial_nor_config_option_t option 
)
Parameters
instancestorage the instance of FLEXSPI.
configA pointer to the storage for the driver runtime state.
optionA pointer to the storage Serial NOR Configuration Option Context.
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentA invalid argument is provided.
kStatus_FLEXSPI_InvalidSequenceA invalid Sequence is provided.
kStatus_FLEXSPI_SequenceExecutionTimeoutSequence Execution timeout.
kStatus_FLEXSPI_DeviceTimeoutthe device timeout
status_t FLEXSPI_NorFlash_Erase ( uint32_t  instance,
flexspi_nor_config_t config,
uint32_t  start,
uint32_t  length 
)

This function erases the appropriate number of flash sectors based on the desired start address and length.

Parameters
instancestorage the index of FLEXSPI.
configA pointer to the storage for the driver runtime state.
startThe start address of the desired NOR flash memory to be erased. NOTE: It is recommended that use sector-aligned access nor device; If dstAddr is not aligned with the sector,the driver automatically aligns address down with the sector address.
lengthThe length, given in bytes to be erased. NOTE: It is recommended that use sector-aligned access nor device; If length is not aligned with the sector,the driver automatically aligns up with the sector.
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentA invalid argument is provided.
kStatus_FLEXSPI_InvalidSequenceA invalid Sequence is provided.
kStatus_FLEXSPI_SequenceExecutionTimeoutSequence Execution timeout.
kStatus_FLEXSPI_DeviceTimeoutthe device timeout
status_t FLEXSPI_NorFlash_Read ( uint32_t  instance,
flexspi_nor_config_t config,
uint32_t *  dst,
uint32_t  start,
uint32_t  bytes 
)

This function read the NOR flash memory with the start address for a given flash area as determined by the dst address and the length.

Parameters
instancestorage the instance of FLEXSPI.
configA pointer to the storage for the driver runtime state.
dstA pointer to the dest buffer of data that is to be read from the NOR flash. NOTE: It is recommended that use page aligned access; If the dstAddr is not aligned to page,the driver automatically aligns address down with the page address.
startThe start address of the desired NOR flash memory to be read.
lengthInBytesThe length, given in bytes to be read.
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentA invalid argument is provided.
kStatus_FLEXSPI_InvalidSequenceA invalid Sequence is provided.
kStatus_FLEXSPI_SequenceExecutionTimeoutSequence Execution timeout.
kStatus_FLEXSPI_DeviceTimeoutthe device timeout
status_t FLEXSPI_NorFlash_CommandXfer ( uint32_t  instance,
flexspi_xfer_t xfer 
)

This function is used to perform the command write sequence to the NOR device.

Parameters
instancestorage the index of FLEXSPI.
xferA pointer to the storage FLEXSPI Transfer Context.
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentA invalid argument is provided.
kStatus_ROM_FLEXSPI_InvalidSequenceA invalid Sequence is provided.
kStatus_ROM_FLEXSPI_SequenceExecutionTimeoutSequence Execution timeout.
status_t FLEXSPI_NorFlash_UpdateLut ( uint32_t  instance,
uint32_t  seqIndex,
const uint32_t *  lutBase,
uint32_t  seqNumber 
)
Parameters
instancestorage the index of FLEXSPI.
seqIndexstorage the sequence Id.
lutBaseA pointer to the look-up-table for command sequences.
seqNumberstorage sequence number.
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentA invalid argument is provided.
kStatus_ROM_FLEXSPI_InvalidSequenceA invalid Sequence is provided.
kStatus_ROM_FLEXSPI_SequenceExecutionTimeoutSequence Execution timeout.
status_t FLEXSPI_NorFlash_SetClockSource ( uint32_t  clockSource)
Parameters
clockSourceClock source for FLEXSPI NOR. See to "_flexspi_nor_clock_source".
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentA invalid argument is provided.

Variable Documentation

uint32_t serial_nor_config_option_t::flash_connection

Parallel mode, 2 - Single Flash connected to Port B

uint32_t { ... } ::flash_connection

Parallel mode, 2 - Single Flash connected to Port B

uint8_t flexspi_mem_config_t::deviceModeType
uint32_t flexspi_mem_config_t::reserved4[2]

[0x1b8-0x1bf] Reserved for future use