Atmel Software Framework

nvm_example.c File Reference

Common NVM service example.

Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.

#include "asf.h"
#include "conf_nvm_example.h"

Functions

int main (void)
 NVM Example Main. More...
 
static status_code_t test_mem (mem_type_t mem, uint32_t test_address)
 Test routine that writes to the non volatile memory, reads back and compares the values. More...
 

int main ( void  )

NVM Example Main.

The NVM example begins by initializing required board resources. The system clock and basic GPIO pin mapping are established.

A memory location on the Non volatile memory is written with a fixed test pattern which is then read back into a separate buffer. As a basic sanity check, the original write-buffer values are compared with values read to a separate buffer. An LED on the development board is illuminated when there is a match between the written and read data.

Returns
Nothing.

References board_init(), INT_FLASH, ioport_set_pin_level(), STATUS_OK, sysclk_init, and test_mem().

static status_code_t test_mem ( mem_type_t  mem,
uint32_t  test_address 
)
static

Test routine that writes to the non volatile memory, reads back and compares the values.

References ERR_BAD_DATA, ERR_INVALID_ARG, nvm_init(), nvm_page_erase(), nvm_read(), nvm_write(), and STATUS_OK.

Referenced by main().