Hello,
Sorry for reposting this. In the last post I was told to use the library but unfortunately it is blocking resources so I cannot use that.
I want to write some information on the Sector 0 of Bank 0 in the main memory. Before writing I am erasing the sector but some how the CPU gets halted somewhere in the erase method.
void FlashCtl::EraseSect()
{
FLCTL->BANK0_MAIN_WEPROT &= ~(FLCTL_BANK0_MAIN_WEPROT_PROT0); // Write/Erase Unprotect
FLCTL->ERASE_SECTADDR = 0x00000000 ; // Sector Address
FLCTL->ERASE_CTLSTAT |= FLCTL_ERASE_CTLSTAT_START; // Start Erase Operation
while((FLCTL->ERASE_CTLSTAT & FLCTL_ERASE_CTLSTAT_STATUS_3) != FLCTL_ERASE_CTLSTAT_STATUS_3) // Erase Completion Status
{
__no_operation();
}
FLCTL->ERASE_CTLSTAT |= FLCTL_ERASE_CTLSTAT_ADDR_ERR;
FLCTL->BANK0_MAIN_WEPROT |= FLCTL_BANK0_MAIN_WEPROT_PROT0;
}