10.6.3.2.4 Function nvm_update_buffer()

Updates an arbitrary section of a page with new data.

enum status_code nvm_update_buffer( const uint32_t destination_address, uint8_t *const buffer, uint16_t offset, uint16_t length)

Writes from a buffer to a given page in the NVM memory, retaining any unmodified data already stored in the page.

Note: If manual write mode is enable, write command must be executed after this function, otherwise the data will not write to NVM from page buffer.
Warning

This routine is unsafe if data integrity is critical; a system reset during the update process will result in up to one row of data being lost. If corruption must be avoided in all circumstances (including power loss or system reset) this function should not be used.

Table 10-13. Parameters
Data directionParameter nameDescription

[in]

destination_address

Destination page address to write to

[in]

buffer

Pointer to buffer where the data to write is stored

[in]

offset

Number of bytes to offset the data write in the page

[in]

length

Number of bytes in the page to update

Returns

Status of the attempt to update a page.

Table 10-14. Return Values
Return valueDescription

STATUS_OK

Requested NVM memory page was successfully read

STATUS_BUSY

NVM controller was busy when the operation was attempted

STATUS_ERR_BAD_ADDRESS

The requested address was outside the acceptable range of the NVM memory region

STATUS_ERR_INVALID_ARG

The supplied length and offset was invalid