Hi,
I was using the atmel start example for reading and writing to flash as illustrated below:
The problem im seeing is that when I power off the system and power back on again the data written to addess 0x3200 is no longer retained.
I can see the memory being written to via the memory view window in Atmel studio (currently using the SAMD21 Xplained Pro) via USB.
Im sorry if I have isunderstood the example and the data sheet but as far as I was aware the SAMD21 between the regions 0x00000000 to 0x00040000 is available and non-volatile.
Can anyone please help?
#include <peripheral_clk_config.h> #include <utils.h> #include <hal_init.h> #include <hpl_gclk_base.h> #include <hpl_pm_base.h> struct flash_descriptor FLASH_0; void FLASH_0_CLOCK_init(void) { _pm_enable_bus_clock(PM_BUS_APBB, NVMCTRL); } void FLASH_0_init(void) { FLASH_0_CLOCK_init(); flash_init(&FLASH_0, NVMCTRL); } void system_init(void) { init_mcu(); FLASH_0_init(); } void FLASH_0_example(void) { uint32_t page_size; uint16_t i; /* Init source data */ page_size = flash_get_page_size(&FLASH_0); for (i = 0; i < page_size; i++) { src_data[i] = i; } /* Write data to flash */ flash_write(&FLASH_0, 0x3200, src_data, page_size); /* Read data from flash */ flash_read(&FLASH_0, 0x3200, chk_data, page_size); }