The Octal Serial Peripheral Interface (OSPI) module is a kind of Serial Peripheral Interface (SPI) module which allows single, dual, quad or octal read and write access to external flash devices. The OSPI module is used to transfer data, either in a memory mapped direct mode (for example a processor wishing to execute code directly from external flash memory), or in an indirect mode where the module is set-up to silently perform some requested operation, signaling its completion via interrupts or status registers.
Features Supported
- Support for single, dual, quad (QSPI mode) or octal I/O instructions.
- Supports dual Quad-SPI mode for fast boot applications.
- Memory mapped ‘direct’ mode of operation for performing flash data transfers and executing code from flash memory.
- Programmable delays between transactions.
- Legacy mode allowing software direct access to low level transmit and receive FIFOs, bypassing the higher layer processes.
- An independent reference clock to decouple bus clock from SPI clock – allows slow system clocks.
- Programmable baud rate generator to generate OSPI clocks.
- Supports BOOT mode.
- Handling ECC errors for flash devices with embedded correction engine.
- Skip tuning, the ospi driver reads the tuning parameters set in the previous stage, by calculating the read delay value, tuning point is set. This saves the boot time by skipping the search for tuning points.
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.
- OSPI instance name
- Input clock frequency to be used for OSPI module
- Input clock divider which decides the baud-rate at which the flash will be read
- Chip Select
- Enable skip tuning
- Enabling of various features like DMA and PHY mode.
- PHY configuration allows to
- Enable/disable fast tuning, configuring fast/default window tuning parameters.
- Set PHY control mode (master/bypass)
- Determine if master delay line locks in half/full cycle of delay.
OSPI PHY Configurations Syscfg
- Tuning window parameters,contains various parameters for OSPI tuning
- Min and Max values for read delays.
- TxDLL low start and end, defines txDLL window for finding rxLow.
- TxDLL high start and end, defines txDLL winodw for finding backup rxLow.
- RxDLL low search start, minimum value for rxLow.
- RxDLL low search end, maximum value for rxLow.
- RxDLL high search start, minimum value for rxHigh.
- RxDLL high search end, maximum value for rxHigh.
- TxDLL low search start, minimum value for txLow.
- TxDLL low search end, maximum value for txLow.
- TxDLL high search start, minimum value for txHigh.
- TxDLL high search end, maximum value for txHigh.
- TxDLL search offset, increment in txDLL value while searching rxLow/rxHigh values.
- RxDL & TxDLL Search Step, step size for finding rx and tx low/high values.
OSPI DEFAULT WINDOW PARAMS
OSPI FAST TUNING WINDOW PARAMS
- In advanced config, you can choose various parameters like frame format, decoder chip select, read dummy cycles etc.
- Pinmux configurations for the OSPI instance
OSPI Phy Tuning Algorithm
The ospi NAND tuning algorithm works as follows:
- Step 1 Fix TxDLL value
Set txDll value to txDllHighWindowEnd.
- Step 2 Find Rx window 1
At fixed TxDLL, find rxStart1 and rxEnd1 in the range rxLowSearchStart and rxHighSearchEnd.
In the range rdDelayMin to rdDelayMax, rxStart1 and rxEnd1 are found.
If not found return failure.
rxWindow1 = rxEnd1 - rxStart1
- Step 3 Find Rx window 2
Find rxStart2 and rxEnd2 at fixed TxDLL, in the range readDelay = readDelay of rxWindow1 + 1 to rdDelayMax.
rxWindow2 = rxEnd2 - rxStart2
- Step 4 Choose Bigger Rx Window
Compare rxWindow1 and rxWindow2, select the larger rxWindow.
- Step 5 Find the Tuning Point
- txDLL value is set to txDLL value fixed in first step
- rdDelay value is set to rdDelay value of larger window
- rxDLL value is set to the midpoint of the rxWindow chosen in step 4.
Features not Supported
- XIP mode is not supported yet.
Example Usage
Include the below file to access the APIs
Instance Open Example
Instance Close Example
API
APIs for OSPI