AM64x MCU+ SDK  08.02.00
OSPI

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.

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
  • Enabling of various features like DMA, PHY mode(not supported yet), XIP(not supported yet)
  • In advanced config, you can choose various parameters like frame format, decoder chip select, read dummy cycles etc.
  • Pinmux configurations for the OSPI instance

Features not Supported

  • PHY mode is not supported yet.
  • Interrupt mode is not supported yet.

Example Usage

Include the below file to access the APIs

#include <stdio.h>
#include <drivers/ospi.h>

Instance Open Example

OSPI_Params ospiParams;
OSPI_Params_init(&ospiParams);
gOspiHandle = OSPI_open(0, &ospiParams);
DebugP_assert(gOspiHandle != NULL);

Instance Close Example

OSPI_close(gOspiHandle);

API

APIs for OSPI

OSPI_Params_init
void OSPI_Params_init(OSPI_Params *ospiParams)
Initialize data structure with defaults.
OSPI_Params
OSPI Parameters.
Definition: ospi/v0/ospi.h:316
OSPI_close
void OSPI_close(OSPI_Handle handle)
Function to close a OSPI peripheral specified by the OSPI handle.
ospi.h
OSPI_open
OSPI_Handle OSPI_open(uint32_t index, const OSPI_Params *openParams)
This function opens a given OSPI peripheral.
DebugP_assert
#define DebugP_assert(expression)
Function to call for assert check.
Definition: DebugP.h:159