NOR FLASH

Nor Flash Overview

NOR Flash (Non-Volatile Read-Only Memory) is a type of non-volatile memory technology commonly used for storing firmware, bootloaders, configuration data, and other essential software in embedded systems, microcontrollers, and consumer electronics. Unlike traditional ROM, NOR Flash memory allows for both reading and writing data. It provides fast read speeds, making it suitable for applications where fast data retrieval is crucial

Application Interface

The below table captures the functions that are to be called from the application layer.

API Functions

Function

Description

rs_norflash_init

To initialize the NOR flash memory.

rs_norflash_read

To reads data from NOR flash memory.

rs_norflash_write

To writes data to NOR flash memory.

rs_norflash_erase_sector

To erases a sector of NOR flash memory.

Error Code

  • Every API’s for the Serial returns some success or failure values. Please refer below section,

NOR Flash Header Details

Documentation from the relevant header as follows:

NOR flash Specific APIs.

Defines macros and functions prototypes for providing NOR flash storage.

Author

Embien RAPIDSEA Team

Copyright

Embien Technologies India Pvt. Ltd.

Typedefs

typedef struct tag_rs_norflash_info rs_norflash_info_t

Functions

rs_ret_val_t rs_norflash_init(rs_norflash_info_t *ptr_norflash)

Initiliaze the NOR flash memory.

This function inits the sector in NOR flash memory.

Parameters:

ptr_norflash[in] - Pointer to the NOR flash memory.

Returns:

0 on success or error code on failure

rs_ret_val_t rs_norflash_read(rs_norflash_info_t *ptr_norflash, uint8_t *ptr_read_data, uint32_t u32_address, uint32_t u32_read_len)

Reads data from NOR flash memory.

This function reads a specified length of data from NOR flash memory starting at the given address.

Parameters:
  • ptr_norflash[in] - ptr_norflash - Pointer to the NOR flash memory.

  • ptr_read_data[out] - Pointer to a buffer where the read data will be stored.

  • u32_address[in] - The address in the NOR flash from which to start reading.

  • u32_read_len[out] - The length of data to read (in bytes).

Returns:

0 on success or error code on failure

rs_ret_val_t rs_norflash_write(rs_norflash_info_t *ptr_norflash, uint8_t *ptr_write_data, uint32_t u32_address, uint32_t u32_write_len)

Writes data to NOR flash memory.

This function writes the specified data to the NOR flash memory starting at the given address.

Parameters:
  • ptr_norflash[in] - ptr_norflash - Pointer to the NOR flash memory.

  • ptr_write_data[in] - Pointer to a buffer containing the data to write.

  • u32_address[in] - The address in the NOR flash where the data should be written.

  • u32_write_len[in] - The length of data to write (in bytes).

Returns:

0 on success or error code on failure

rs_ret_val_t rs_norflash_erase_sector(rs_norflash_info_t *ptr_norflash, uint32_t u32_address)

Erases a sector of NOR flash memory.

This function erases the sector in NOR flash memory that contains the specified address.

Parameters:
  • ptr_norflash[in] - ptr_norflash - Pointer to the NOR flash memory.

  • u32_address[in] - The address within the sector to erase. The address should be aligned to the start of the sector.

Returns:

0 on success or error code on failure

struct tag_rs_norflash_info

Public Members

uint8_t port

Port number.

uint8_t is_norflash_available

NOR Flash availability status.

uint32_t manufacture_id

Manufacturer ID of the NOR Flash.

uint16_t page_size

Page size of the NOR Flash in bytes.

uint32_t sector_size

Sector size of the NOR Flash in bytes.

uint32_t block_count

Total number of blocks in the NOR Flash.

rs_handle_t interface_handle

Handle for the NOR Flash interface.

void (*init_interface)(int)

Function to initialize the NOR Flash interface.

void (*select_card)(int)

Function to select the NOR Flash card.

void (*transfer_data)(char*, int, char*, int)

Function to transfer data to/from the NOR Flash.

void (*set_bitrate)(uint32_t)

Function to set the bitrate for the NOR Flash interface.