10.6.3.2.2 Function nvm_write_buffer()

Writes a number of bytes to a page in the NVM memory region.

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

Writes from a buffer to a given page address in the NVM memory.

Table 10-9. 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]

length

Number of bytes in the page to write

Note: If writing to a page that has previously been written to, the page's row should be erased (via nvm_erase_row()) before attempting to write new data to the page.
Note: For SAM D21 RWW devices, see SAMD21_64K, command NVM_COMMAND_RWWEE_WRITE_PAGE must be executed before any other commands after writing a page, refer to errata 13588.
Note: If manual write mode is enabled, the write command must be executed after this function, otherwise the data will not write to NVM from page buffer.

Returns

Status of the attempt to write a page.

Table 10-10. 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 or not aligned to the start of a page

STATUS_ERR_INVALID_ARG

The supplied write length was invalid