[ATSAMD51J18A-AU] Accessing Flash memory

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0



We are using ATSAMD51J18A MCU in our project. We need a space in flash to store the default settings. We have referred the ASF4 API reference manual (http://ww1.microchip.com/downloa...) and noticed that we have API's for accessing the flash memory.


We have added the FLash_0 software component while configuring using Atmel Start configuration and generated the solution also. We are able to find the below example in API manual,


Does the same will work in SAMD51 MCU , since API manual will be suitable for many Atmel MCU's? Also, how to find the starting flash memory address as they mentioned in below example as "0x3200".


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);