1.21.12.3 NVM_RowWrite Function

C

bool NVM_RowWrite( uint32_t* data, uint32_t address )

Summary

Writes one row of data to given NVM address.

Description

This function will write one row of data to the NVM address specified by the address parameter. The size of the input buffer should be one NVM row. The address should be aligned on a row boundary. Calling this function will cause the CPU execution to stall, hence blocking execution of any other thread. Execution resumes when the Write operation has completed.

If the interrupt operation was enabled and if a callback was registered, then the callback function will be called. The NVM_IsBusy() function can be used to poll for completion of the operation. The application should ensure that there are no other operations in progress before calling this function. Once the operation is complete, the NVM_ErrorGet() function can be called to check operation success.

Precondition

Validate if NVM controller is ready to accept a new request by calling NVM_IsBusy(). A page containing the row should be erased before the row can be written.

Parameters

Param Description
address start address of row to be written. This should be aligned on a row boundary.
data pointer to data buffer. The size of this buffer should be the same as

Returns

Always return true.

Example

// This code snippet shows how the NVM_RowWrite function is called and
// how the NVM_IsBusy function is used to poll for completion.

// Erase the page. This will erase all the rows in the page.
NVM_PageErase(0x9D100000);
while(NVM_IsBusy());

// Now write the row.
NVM_RowWrite( (uint32_t *)buffer, 0x9D100000);
while(NVM_IsBusy());

if(NVM_ErrorGet() == NVM_ERROR_NONE)
{
    // Operation was successful.
}