MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
EEPROM: EEPROM memory driver

Overview

The MCUXpresso SDK provides a peripheral driver for the eeprom module of MCUXpresso SDK devices.

Typical use case

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/eeprom

Data Structures

struct  eeprom_config_t
 EEPROM region configuration structure. More...
 

Enumerations

enum  eeprom_auto_program_t {
  kEEPROM_AutoProgramDisable = 0x0,
  kEEPROM_AutoProgramWriteWord = 0x1,
  kEEPROM_AutoProgramLastWord = 0x2
}
 EEPROM automatic program option. More...
 
enum  eeprom_interrupt_enable_t { kEEPROM_ProgramFinishInterruptEnable = EEPROM_INTENSET_PROG_SET_EN_MASK }
 EEPROM interrupt source. More...
 

Driver version

#define FSL_EEPROM_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 EEPROM driver version 2.0.0. More...
 

Initialization and deinitialization

void EEPROM_Init (EEPROM_Type *base, const eeprom_config_t *config, uint32_t sourceClock_Hz)
 Initializes the EEPROM with the user configuration structure. More...
 
void EEPROM_GetDefaultConfig (eeprom_config_t *config)
 Get EEPROM default configure settings. More...
 
void EEPROM_Deinit (EEPROM_Type *base)
 Deinitializes the EEPROM regions. More...
 

Basic Control Operations

static void EEPROM_SetAutoProgram (EEPROM_Type *base, eeprom_auto_program_t autoProgram)
 Set EEPROM automatic program feature. More...
 
static void EEPROM_SetPowerDownMode (EEPROM_Type *base, bool enable)
 Set EEPROM to in/out power down mode. More...
 
static void EEPROM_EnableInterrupt (EEPROM_Type *base, uint32_t mask)
 Enable EEPROM interrupt. More...
 
static void EEPROM_DisableInterrupt (EEPROM_Type *base, uint32_t mask)
 Disable EEPROM interrupt. More...
 
static uint32_t EEPROM_GetInterruptStatus (EEPROM_Type *base)
 Get the status of all interrupt flags for ERPROM. More...
 
static uint32_t EEPROM_GetEnabledInterruptStatus (EEPROM_Type *base)
 Get the status of enabled interrupt flags for ERPROM. More...
 
static void EEPROM_SetInterruptFlag (EEPROM_Type *base, uint32_t mask)
 Set interrupt flags manually. More...
 
static void EEPROM_ClearInterruptFlag (EEPROM_Type *base, uint32_t mask)
 Clear interrupt flags manually. More...
 
status_t EEPROM_WriteWord (EEPROM_Type *base, uint32_t offset, uint32_t data)
 Write a word data in address of EEPROM. More...
 
status_t EEPROM_WritePage (EEPROM_Type *base, uint32_t pageNum, uint32_t *data)
 Write a page data into EEPROM. More...
 

Data Structure Documentation

struct eeprom_config_t

Data Fields

eeprom_auto_program_t autoProgram
 Automatic program feature. More...
 
uint8_t readWaitPhase1
 EEPROM read waiting phase 1.
 
uint8_t readWaitPhase2
 EEPROM read waiting phase 2.
 
uint8_t writeWaitPhase1
 EEPROM write waiting phase 1.
 
uint8_t writeWaitPhase2
 EEPROM write waiting phase 2.
 
uint8_t writeWaitPhase3
 EEPROM write waiting phase 3.
 
bool lockTimingParam
 If lock the read and write wait phase settings.
 

Field Documentation

eeprom_auto_program_t eeprom_config_t::autoProgram

Macro Definition Documentation

#define FSL_EEPROM_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))

Enumeration Type Documentation

Enumerator
kEEPROM_AutoProgramDisable 

Disable auto program.

kEEPROM_AutoProgramWriteWord 

Auto program triggered after 1 word is written.

kEEPROM_AutoProgramLastWord 

Auto program triggered after last word of a page written.

Enumerator
kEEPROM_ProgramFinishInterruptEnable 

Interrupt while program finished.

Function Documentation

void EEPROM_Init ( EEPROM_Type *  base,
const eeprom_config_t config,
uint32_t  sourceClock_Hz 
)

This function configures the EEPROM module with the user-defined configuration. This function also sets the internal clock frequency to about 155kHz according to the source clock frequency.

Parameters
baseEEPROM peripheral base address.
configThe pointer to the configuration structure.
sourceClock_HzEEPROM source clock frequency in Hz.
void EEPROM_GetDefaultConfig ( eeprom_config_t config)
Parameters
configEEPROM config structure pointer.
void EEPROM_Deinit ( EEPROM_Type *  base)
Parameters
baseEEPROM peripheral base address.
static void EEPROM_SetAutoProgram ( EEPROM_Type *  base,
eeprom_auto_program_t  autoProgram 
)
inlinestatic

EEPROM write always needs a program and erase cycle to write the data into EEPROM. This program and erase cycle can be finished automaticlly or manually. If users want to use or disable auto program feature, users can call this API.

Parameters
baseEEPROM peripheral base address.
autoProgramEEPROM auto program feature need to set.
static void EEPROM_SetPowerDownMode ( EEPROM_Type *  base,
bool  enable 
)
inlinestatic

This function make EEPROM eneter or out of power mode. Notice that, users shall not put EEPROM into power down mode while there is still any pending EEPROM operation. While EEPROM is wakes up from power down mode, any EEPROM operation has to be suspended for 100 us.

Parameters
baseEEPROM peripheral base address.
enableTrue means enter to power down mode, false means wake up.
static void EEPROM_EnableInterrupt ( EEPROM_Type *  base,
uint32_t  mask 
)
inlinestatic
Parameters
baseEEPROM peripheral base address.
maskEEPROM interrupt enable mask. It is a logic OR of members the enumeration :: eeprom_interrupt_enable_t
static void EEPROM_DisableInterrupt ( EEPROM_Type *  base,
uint32_t  mask 
)
inlinestatic
Parameters
baseEEPROM peripheral base address.
maskEEPROM interrupt enable mask. It is a logic OR of members the enumeration :: eeprom_interrupt_enable_t
static uint32_t EEPROM_GetInterruptStatus ( EEPROM_Type *  base)
inlinestatic
Parameters
baseEEPROM peripheral base address.
Returns
EEPROM interrupt flag status
static uint32_t EEPROM_GetEnabledInterruptStatus ( EEPROM_Type *  base)
inlinestatic
Parameters
baseEEPROM peripheral base address.
Returns
EEPROM enabled interrupt flag status
static void EEPROM_SetInterruptFlag ( EEPROM_Type *  base,
uint32_t  mask 
)
inlinestatic

This API trigger a interrupt manually, users can no need to wait for hardware trigger interrupt. Call this API will set the corresponding bit in INSTAT register.

Parameters
baseEEPROM peripheral base address.
maskEEPROM interrupt flag need to be set. It is a logic OR of members of enumeration:: eeprom_interrupt_enable_t
static void EEPROM_ClearInterruptFlag ( EEPROM_Type *  base,
uint32_t  mask 
)
inlinestatic

This API clears interrupt flags manually. Call this API will clear the corresponding bit in INSTAT register.

Parameters
baseEEPROM peripheral base address.
maskEEPROM interrupt flag need to be cleared. It is a logic OR of members of enumeration:: eeprom_interrupt_enable_t
status_t EEPROM_WriteWord ( EEPROM_Type *  base,
uint32_t  offset,
uint32_t  data 
)

Users can write a page or at least a word data into EEPROM address.

Parameters
baseEEPROM peripheral base address.
offsetOffset from the begining address of EEPROM. This value shall be 4-byte aligned.
dataData need be write.
status_t EEPROM_WritePage ( EEPROM_Type *  base,
uint32_t  pageNum,
uint32_t *  data 
)

Users can write a page or at least a word data into EEPROM address.

Parameters
baseEEPROM peripheral base address.
pageNumPage number to be written.
dataData need be write. This array data size shall equals to the page size.