Hallo,
Ich scheitere derzeit daran, eine komplette 512 Byte Page der flash zu
beschreiben. Der nachfolgende Code schreibt in die ersten 2 Byte auf
jeder Page 0x00. Ich verstehe nicht,warum.
void ReadAndWriteFlash(void)
{
/* Assume success until proven otherwise. */
bool success = true;
PMIC_SetVectorLocationToBoot();
/* Fill the entire application section of the flash memory with bogus
data */
for (uint32_t address = 0; address < APP_END;
address+=FLASH_PAGE_SIZE) {
/* Load flash buffer with data */
ClearFlashBuffer(); //Clear the flash buffer first to avoid data
corruption
for (uint16_t i = 0; i < FLASH_PAGE_SIZE; i += 2) {
uint8_t lowByte = i;
uint8_t highByte = i+1;
LoadFlashWord((uint32_t)i, ((uint16_t) highByte << 8) | lowByte);
SP_WaitForSPM();
PORTE.OUTTGL = 0x01;
}
/* Perform erase-page write. */
EraseWriteApplicatioPage(address);