nRF5 SDK v17.1.0
Functions
NVMC driver

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
addressAddress to be checked.
valueValue to be checked.
Return values
trueByte can be written at the specified address.
falseByte 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
addressAddress to write to.
valueValue 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
addressAddress to write to.
srcPointer to the data to copy from.
num_bytesNumber 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
addressAddress of the first word in the page to erase.
Return values
NRFX_SUCCESSPage erase complete.
NRFX_ERROR_INVALID_ADDRAddress 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_SUCCESSUICR has been successfully erased.
NRFX_ERROR_NOT_SUPPORTEDUICR 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
addressAddress to be checked. Must be word-aligned.
valueValue to be checked.
Return values
trueWord can be written at the specified address.
falseWord 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
addressAddress to write to. Must be word-aligned.
valueValue 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
addressAddress to write to. Must be word-aligned.
srcPointer to data to copy from. Must be word-aligned.
num_wordsNumber 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
trueLast write completed successfully.
falseLast write is still in progress.

Documentation feedback | Developer Zone | Subscribe | Updated