Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21942

MSP432 - Trying to Erase the Sector 0 Bank 0 before Writing to it but CPU gets halted somewhere.

$
0
0

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


Viewing all articles
Browse latest Browse all 21942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>