NVMC driver

nRF5 SDK v16.0.0

Non-Volatile Memory Controller (NVMC) peripheral driver. More...

Functions

nrfx_err_t nrfx_nvmc_page_erase (uint32_t address)
Function for erasing a page in flash. More...
nrfx_err_t nrfx_nvmc_uicr_erase (void)
Function for erasing the user information configuration register (UICR). More...
void nrfx_nvmc_all_erase (void)
Function for erasing the whole flash memory. More...
bool nrfx_nvmc_byte_writable_check (uint32_t address, uint8_t value)
Function for checking whether a byte is writable at the specified address. More...
void nrfx_nvmc_byte_write (uint32_t address, uint8_t value)
Function for writing a single byte to flash. More...
bool nrfx_nvmc_word_writable_check (uint32_t address, uint32_t value)
Function for checking whether a word is writable at the specified address. More...
void nrfx_nvmc_word_write (uint32_t address, uint32_t value)
Function for writing a 32-bit word to flash. More...
void nrfx_nvmc_bytes_write (uint32_t address, void const *src, uint32_t num_bytes)
Function for writing consecutive bytes to flash. More...
void nrfx_nvmc_words_write (uint32_t address, void const *src, uint32_t num_words)
Function for writing consecutive words to flash. More...
uint32_t nrfx_nvmc_flash_size_get (void)
Function for getting the total flash size in bytes. More...
uint32_t nrfx_nvmc_flash_page_size_get (void)
Function for getting the flash page size in bytes. More...
uint32_t nrfx_nvmc_flash_page_count_get (void)
Function for getting the flash page count. More...
__STATIC_INLINE bool nrfx_nvmc_write_done_check (void)
Function for checking if the last flash write has been completed. More...

Detailed Description

Non-Volatile Memory Controller (NVMC) peripheral driver.

Function Documentation

void nrfx_nvmc_all_erase ( void )

Function for erasing the whole flash memory.

Note
All user code and UICR will be erased.
bool nrfx_nvmc_byte_writable_check ( uint32_t address ,
uint8_t value
)

Function for checking whether a byte is writable at the specified address.

The NVMC is only able to write '0' to bits in the flash that are erased (set to '1'). It cannot rewrite a bit back to '1'. This function checks if the value currently residing at the specified address can be transformed to the desired value without any '0' to '1' transitions.

Parameters
address Address to be checked.
value Value to be checked.
Return values
true Byte can be written at the specified address.
false Byte cannot be written at the specified address. Erase the page or change the address.
void nrfx_nvmc_byte_write ( uint32_t address ,
uint8_t value
)

Function for writing a single byte to flash.

To determine if the flash write has been completed, use nrfx_nvmc_write_done_check() .

Note
Depending on the source of the code being executed, the CPU may be halted during the operation. Refer to the Product Specification for more information.
Parameters
address Address to write to.
value Value to write.
void nrfx_nvmc_bytes_write ( uint32_t address ,
void const * src ,
uint32_t num_bytes
)

Function for writing consecutive bytes to flash.

To determine if the last flash write has been completed, use nrfx_nvmc_write_done_check() .

Note
Depending on the source of the code being executed, the CPU may be halted during the operation. Refer to the Product Specification for more information.
Parameters
address Address to write to.
src Pointer to the data to copy from.
num_bytes Number of bytes to write.
uint32_t nrfx_nvmc_flash_page_count_get ( void )

Function for getting the flash page count.

Returns
Flash page count.
uint32_t nrfx_nvmc_flash_page_size_get ( void )

Function for getting the flash page size in bytes.

Returns
Flash page size in bytes.
uint32_t nrfx_nvmc_flash_size_get ( void )

Function for getting the total flash size in bytes.

Returns
Flash total size in bytes.
nrfx_err_t nrfx_nvmc_page_erase ( uint32_t address )

Function for erasing a page in flash.

This function blocks until the erase operation finishes.

Note
Depending on the source of the code being executed, the CPU may be halted during the operation. Refer to the Product Specification for more information.
Parameters
address Address of the first word in the page to erase.
Return values
NRFX_SUCCESS Page erase complete.
NRFX_ERROR_INVALID_ADDR Address is not aligned to the size of the page.
nrfx_err_t nrfx_nvmc_uicr_erase ( void )

Function for erasing the user information configuration register (UICR).

Note
Depending on the source of the code being executed, the CPU may be halted during the operation. Refer to the Product Specification for more information.
Return values
NRFX_SUCCESS UICR has been successfully erased.
NRFX_ERROR_NOT_SUPPORTED UICR erase is not supported.
bool nrfx_nvmc_word_writable_check ( uint32_t address ,
uint32_t value
)

Function for checking whether a word is writable at the specified address.

The NVMC is only able to write '0' to bits in the Flash that are erased (set to '1'). It cannot rewrite a bit back to '1'. This function checks if the value currently residing at the specified address can be transformed to the desired value without any '0' to '1' transitions.

Parameters
address Address to be checked. Must be word-aligned.
value Value to be checked.
Return values
true Word can be written at the specified address.
false Word cannot be written at the specified address. Erase page or change address.
void nrfx_nvmc_word_write ( uint32_t address ,
uint32_t value
)

Function for writing a 32-bit word to flash.

To determine if the flash write has been completed, use nrfx_nvmc_write_done_check() .

Note
Depending on the source of the code being executed, the CPU may be halted during the operation. Refer to the Product Specification for more information.
Parameters
address Address to write to. Must be word-aligned.
value Value to write.
void nrfx_nvmc_words_write ( uint32_t address ,
void const * src ,
uint32_t num_words
)

Function for writing consecutive words to flash.

To determine if the last flash write has been completed, use nrfx_nvmc_write_done_check() .

Note
Depending on the source of the code being executed, the CPU may be halted during the operation. Refer to the Product Specification for more information.
Parameters
address Address to write to. Must be word-aligned.
src Pointer to data to copy from. Must be word-aligned.
num_words Number of words to write.
__STATIC_INLINE bool nrfx_nvmc_write_done_check ( void )

Function for checking if the last flash write has been completed.

Return values
true Last write completed successfully.
false Last write is still in progress.