1.32.16.24 NVMCTRL_PageBufferWrite Function

C

bool NVMCTRL_PageBufferWrite( uint32_t *data, const uint32_t address)

Summary

Writes data to the internal buffer of NVM known as the page buffer

Description

Writes data to the internal buffer of NVM known as the page buffer. Use this API if multiple updates are required to the same Flash page and to avoid erasing the page multiple times. When all the updates to the page are done, commit the data to the flash by calling the NVMCTRL_PageBufferCommit() API.

Precondition

The NVMCTRL_Initialize() function should have been called once.

Parameters

Param Description
data pointer to data buffer.
address Data Flash address to be modified.

Returns

true if the operation was successful, else returns false.

Example

uint32_t* data; //data - pointer to the buffer to be written to flash memory
uint32_t flashAddr; //flashAddr - variable containing flash address

//populate data and flashAddr

NVMCTRL_PageBufferWrite((uint32_t*)data, (uint32_t)flashAddr);

//update data here

NVMCTRL_PageBufferWrite((uint32_t*)data, (uint32_t)flashAddr);

//Commit the final data in the NVM internal page buffer to the flash memory
NVMCTRL_PageBufferCommit((uint32_t)flashAddr);

//Wait until the NVM controller is busy
while (NVMCTRL_IsBusy());

Remarks

This API is works only if the NVM is configured for manual write policy