AM62Ax MCU+ SDK  10.01.00
Flash

The driver takes care of all sequencing necessary to perform writes across pages and the application need not take care of the programming intricacies.

Features Supported

  • APIs to read and write to a flash offset
  • Provides API to return flash attributes like block size, page size etc
  • API for block erases

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.
  • Option to select flash type based on board
  • Supported flash devices
    • W35N01JW

Features NOT Supported

NA

Important Usage Guidelines

  • Typically before writing to an offset, erase the block which corresponds to the offset
  • Flash writes can only be done to a page size aligned offset, otherwise the write API returns an error

Example Usage

Include the below file to access the APIs

#include <board/flash.h>

Flash Read API

uint32_t offset;
/* Set offset to read from */
offset = 0;
/* Do the read */
status = Flash_read(handle, offset, buffer, 100);

Flash Write API

uint32_t offset;
/* Set offset to write to */
offset = 0;
/* Do the write */
status = Flash_write(handle, offset, buffer, 100);

Flash Erase API

uint32_t offset, blk, page;
/* Set offset to erase */
offset = 0;
/* Find the block number corresponding to the offset */
status = Flash_offsetToBlkPage(handle, offset, &blk, &page);
/* Erase the block */
status = Flash_eraseBlk(handle,blk);

API

APIs for FLASH

status
uint32_t status
Definition: tisci_lpm.h:1
Flash_offsetToBlkPage
int32_t Flash_offsetToBlkPage(Flash_Handle handle, uint32_t offset, uint32_t *block, uint32_t *page)
Utility API to convert offset in bytes to (Block Num, Page Num)
SystemP_SUCCESS
#define SystemP_SUCCESS
Return status when the API execution was successful.
Definition: SystemP.h:56
DebugP_assert
#define DebugP_assert(expression)
Function to call for assert check.
Definition: DebugP.h:175
Flash_eraseBlk
int32_t Flash_eraseBlk(Flash_Handle handle, uint32_t blockNum)
Erase a block from flash.
Flash_write
int32_t Flash_write(Flash_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
Write to flash.
flash.h
Flash_read
int32_t Flash_read(Flash_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
Read data from flash.