AM261x MCU+ SDK  11.01.00
Generic NOR Flash API for single pin mode

Introduction

These APIs try to communicate with whichever flash is connected the OSPI peripheral in 1-1-1 mode. This can be used in bringing up new flashes and mostly used for debug and diagnostic purposes

Functions

int32_t OSPI_norFlashInit1s1s1s (OSPI_Handle handle)
 This function initializes the NOR flash to work in 1-1-1 mode. More...
 
void OSPI_norFlashSetCmds (uint8_t rdCmd, uint8_t wrCmd, uint8_t eraseCmd)
 This function sets up internal bookkeeping variables for read, write and erase commands. This API has to be called immediately before OSPI_norFlashInit1s1s1s. More...
 
int32_t OSPI_norFlashReadId (OSPI_Handle handle, uint32_t *manufacturerId, uint32_t *deviceId)
 This function tries to read the JEDEC ID from the NOR flash connected to the OSPI peripheral. More...
 
int32_t OSPI_norFlashWrite (OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
 This function writes data to the flash at a specified offset. More...
 
int32_t OSPI_norFlashRead (OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
 This function reads data from the flash from a specified offset. More...
 
int32_t OSPI_norFlashReadSfdp (OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
 This function reads SFDP table from the flash from a specified offset. More...
 
int32_t OSPI_norFlashErase (OSPI_Handle handle, uint32_t address)
 This function erases 1 block of data starting from a provided address. More...
 
int32_t OSPI_configResetPin (OSPI_Handle handle, uint32_t config)
 This function configures reset functionality. More...
 
int32_t OSPI_configBaudrate (OSPI_Handle handle, uint32_t baud)
 Configures baud divider. More...
 
int32_t OSPI_readBaudRateDivFromReg (OSPI_Handle handle, uint32_t *baudDiv)
 Return value of baudrate that is programmed in IP register. More...
 
int32_t OSPI_getBaudRateDivFromObj (OSPI_Handle handle, uint32_t *baudDiv)
 Return value of baudrate that is saved in OSPI Object. More...
 
int32_t OSPI_setResetPinStatus (OSPI_Handle handle, uint32_t pinStatus)
 This function activates the RESET pin feature. More...
 
int32_t OSPI_phyValidateTuningPoint (OSPI_Handle handle, uint32_t flashOffset)
 Validates a specific tuning point for OSPI PHY. More...
 
uint32_t OSPI_isValidateOtpEnable (OSPI_Handle handle)
 Checks if Phy tuning point validation is enabled. More...
 
int32_t OSPI_setFrequency (OSPI_Handle handle, uint64_t inputClkFreq)
 Sets the operating frequency for the OSPI peripheral. More...
 
int32_t OSPI_setDelays (OSPI_Handle handle, uint32_t inputClkFreq)
 Sets timing delays for the OSPI interface based on input clock frequency. More...
 
int32_t OSPI_setBaudRateDiv (OSPI_Handle handle, uint32_t baudRateDiv)
 Sets the baud rate divider for OSPI communication. More...
 

Function Documentation

◆ OSPI_norFlashInit1s1s1s()

int32_t OSPI_norFlashInit1s1s1s ( OSPI_Handle  handle)

This function initializes the NOR flash to work in 1-1-1 mode.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
handleAn OSPI_Handle returned from an OSPI_open()
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_norFlashSetCmds()

void OSPI_norFlashSetCmds ( uint8_t  rdCmd,
uint8_t  wrCmd,
uint8_t  eraseCmd 
)

This function sets up internal bookkeeping variables for read, write and erase commands. This API has to be called immediately before OSPI_norFlashInit1s1s1s.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
rdCmdCommand to be used in single mode read
wrCmdCommand to be used in single mode write/page program
eraseCmdCommand to be used to erase (block or sector)

◆ OSPI_norFlashReadId()

int32_t OSPI_norFlashReadId ( OSPI_Handle  handle,
uint32_t *  manufacturerId,
uint32_t *  deviceId 
)

This function tries to read the JEDEC ID from the NOR flash connected to the OSPI peripheral.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
handleAn OSPI_Handle returned from an OSPI_open()
manufacturerIdPointer to a uint32_t variable. This will be filled with the manufacturer ID on success
deviceIdPointer to a uint32_t variable. This will be filled with the device ID on success
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_norFlashWrite()

int32_t OSPI_norFlashWrite ( OSPI_Handle  handle,
uint32_t  offset,
uint8_t *  buf,
uint32_t  len 
)

This function writes data to the flash at a specified offset.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
handleAn OSPI_Handle returned from an OSPI_open()
offsetOffset at which the data is to be written
bufBuffer which has the data to be written to the flash
lenNumber of bytes to be written to the flash
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_norFlashRead()

int32_t OSPI_norFlashRead ( OSPI_Handle  handle,
uint32_t  offset,
uint8_t *  buf,
uint32_t  len 
)

This function reads data from the flash from a specified offset.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
handleAn OSPI_Handle returned from an OSPI_open()
offsetOffset at which the data is to be read from
bufBuffer to which data will be written into
lenNumber of bytes to be read from the flash
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_norFlashReadSfdp()

int32_t OSPI_norFlashReadSfdp ( OSPI_Handle  handle,
uint32_t  offset,
uint8_t *  buf,
uint32_t  len 
)

This function reads SFDP table from the flash from a specified offset.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
handleAn OSPI_Handle returned from an OSPI_open()
offsetOffset at which the data is to be read from
bufBuffer to which data will be written into
lenNumber of bytes to be read from the flash
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_norFlashErase()

int32_t OSPI_norFlashErase ( OSPI_Handle  handle,
uint32_t  address 
)

This function erases 1 block of data starting from a provided address.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
handleAn OSPI_Handle returned from an OSPI_open()
addressAddress of the data block to be erased. This address should be block aligned.
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_configResetPin()

int32_t OSPI_configResetPin ( OSPI_Handle  handle,
uint32_t  config 
)

This function configures reset functionality.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
handleAn OSPI_Handle returned from an OSPI_open()
configreset config
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_configBaudrate()

int32_t OSPI_configBaudrate ( OSPI_Handle  handle,
uint32_t  baud 
)

Configures baud divider.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
handleAn OSPI_Handle returned from an OSPI_open()
baudbaudrate from 2 to 32 and divisible by 2
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_readBaudRateDivFromReg()

int32_t OSPI_readBaudRateDivFromReg ( OSPI_Handle  handle,
uint32_t *  baudDiv 
)

Return value of baudrate that is programmed in IP register.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
handleAn OSPI_Handle returned from an OSPI_open()
baudDivpointer to memory into which baudrate will be written
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_getBaudRateDivFromObj()

int32_t OSPI_getBaudRateDivFromObj ( OSPI_Handle  handle,
uint32_t *  baudDiv 
)

Return value of baudrate that is saved in OSPI Object.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
handleAn OSPI_Handle returned from an OSPI_open()
baudDivpointer to memory into which baudrate will be written
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_setResetPinStatus()

int32_t OSPI_setResetPinStatus ( OSPI_Handle  handle,
uint32_t  pinStatus 
)

This function activates the RESET pin feature.

Precondition
OSPI controller has been opened using OSPI_open()
Parameters
handleAn OSPI_Handle returned from an OSPI_open()
pinStatuspinStatus - HIGH/LOW
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_phyValidateTuningPoint()

int32_t OSPI_phyValidateTuningPoint ( OSPI_Handle  handle,
uint32_t  flashOffset 
)

Validates a specific tuning point for OSPI PHY.

This function validates whether a given tuning point can be used for reliable communication with the OSPI flash device. It performs data read operations at the specified flash offset to determine if the current PHY settings provide error-free data transfer.

Parameters
handleOSPI driver handle
flashOffsetFlash memory offset to use for validation testing
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_isValidateOtpEnable()

uint32_t OSPI_isValidateOtpEnable ( OSPI_Handle  handle)

Checks if Phy tuning point validation is enabled.

This function verifies whether the validation for One-Time Programmable memory is currently enabled on the OSPI interface.

Parameters
handleHandle to the OSPI instance
Returns
return 1 if OTP validation is enabled, 0 otherwise

◆ OSPI_setFrequency()

int32_t OSPI_setFrequency ( OSPI_Handle  handle,
uint64_t  inputClkFreq 
)

Sets the operating frequency for the OSPI peripheral.

This function configures the OSPI controller to operate at the specified frequency based on the input clock frequency provided.

Parameters
handleOSPI driver handle
inputClkFreqInput clock frequency in Hz
Returns
SystemP_SUCCESS on success, error code on failure

◆ OSPI_setDelays()

int32_t OSPI_setDelays ( OSPI_Handle  handle,
uint32_t  inputClkFreq 
)

Sets timing delays for the OSPI interface based on input clock frequency.

This function configures the appropriate timing delays for the OSPI interface to ensure reliable communication with external memory devices. The delays are calculated based on the provided input clock frequency.

Parameters
handleOSPI handle to the peripheral instance
inputClkFreqInput clock frequency in Hz
Returns
SystemP_SUCCESS on success, error code on failure

◆ OSPI_setBaudRateDiv()

int32_t OSPI_setBaudRateDiv ( OSPI_Handle  handle,
uint32_t  baudRateDiv 
)

Sets the baud rate divider for OSPI communication.

This function configures the baud rate divider to control the OSPI clock frequency. The actual OSPI clock frequency is determined by dividing the input clock frequency by the specified baud rate divider.

Parameters
handleOSPI handle
baudRateDivBaud rate divider value
Returns
SystemP_SUCCESS on success, error code on failure