R1 code for micro:bit based train controller code, requires second micro:bit running rx code to operate - see https://meanderingpi.wordpress.com/ for more information

Fork of nrf51-sdk by Lancaster University

Embed: (wiki syntax)

« Back to documentation index

Non-volatile memory controller

Non-volatile memory controller

Driver for the NVMC peripheral. More...

Functions

void nrf_nvmc_page_erase (uint32_t address)
 Erase a page in flash.
void nrf_nvmc_write_byte (uint32_t address, uint8_t value)
 Write a single byte to flash.
void nrf_nvmc_write_word (uint32_t address, uint32_t value)
 Write a 32-bit word to flash.
void nrf_nvmc_write_bytes (uint32_t address, const uint8_t *src, uint32_t num_bytes)
 Write consecutive bytes to flash.
void nrf_nvmc_write_words (uint32_t address, const uint32_t *src, uint32_t num_words)
 Write consecutive words to flash.

Detailed Description

Driver for the NVMC peripheral.

This driver allows writing to the non-volatile memory (NVM) regions of the chip. In order to write to NVM the controller must be powered on and the relevant page must be erased.


Function Documentation

void nrf_nvmc_page_erase ( uint32_t  address )

Erase a page in flash.

This is required before writing to any address in the page.

Parameters:
addressStart address of the page.

Definition at line 43 of file nrf_nvmc.c.

void nrf_nvmc_write_byte ( uint32_t  address,
uint8_t  value 
)

Write a single byte to flash.

The function reads the word containing the byte, and then rewrites the entire word.

Parameters:
addressAddress to write to.
valueValue to write.

Definition at line 64 of file nrf_nvmc.c.

void nrf_nvmc_write_bytes ( uint32_t  address,
const uint8_t *  src,
uint32_t  num_bytes 
)

Write consecutive bytes to flash.

Parameters:
addressAddress to write to.
srcPointer to data to copy from.
num_bytesNumber of bytes in src to write.

Definition at line 104 of file nrf_nvmc.c.

void nrf_nvmc_write_word ( uint32_t  address,
uint32_t  value 
)

Write a 32-bit word to flash.

Parameters:
addressAddress to write to.
valueValue to write.

Definition at line 87 of file nrf_nvmc.c.

void nrf_nvmc_write_words ( uint32_t  address,
const uint32_t *  src,
uint32_t  num_words 
)

Write consecutive words to flash.

Parameters:
addressAddress to write to.
srcPointer to data to copy from.
num_wordsNumber of bytes in src to write.

Definition at line 113 of file nrf_nvmc.c.