I think I'm missing something fundamental here. I have code stored in an external memory and loading it page by page to be programmed into the internal flash (Flash0 in particular). I have been reviewing the ASF example and what I'm doing looks right but I'm getting nothing happening in the flash. If I step through the area where the writing actually takes place nothing gets hung up whereas full speed it jumps to a strange location in code and stops, so getting weirdness. Still nothing ever shows up as written to the flash verifying through the debugger. Incidentally the EFC Status register shows success without error when stepping through. Code snippet is below:

If anyone can shed some light on this it would be much appreciated. I've read the manual up and down trying to figure out precisely how this should all work and I'm not finding anything new. Using Studio 6 for development and debug.

Also, for the Sam3U4 this is a 2 bank flash. So your code that performs the write needs to run from RAM or the other bank so it is not writing to the same bank that code is executing from.

Alternatively you try using the IAP function/feature that is located in the ROM of the part to perform the Writes (this would allow writing to either bank) and the heavy lifting is already done for you. Search the document that is linked (or in the Datasheet) for "IAP" for an example of its use.

Hi jkellar,
i'm trying to write a code for a sam3x8e, to perform an update of the firmware of my sam3x, reading the new firmware from a usb pen drive and store it in flash.

at the moment i read the file and i try to use the flash_write function, wrinting on the second flash bank and at the end of the process i set the gpnvm(2) bit, this to use the dual bank boot capabilities of sam3x but I'm encountering some difficulties and no way to have something working.