Skip to main content
Visitor II
August 31, 2006
Question

Flash Unprotect

  • August 31, 2006
  • 1 reply
  • 614 views
Posted on August 31, 2006 at 05:38

Flash Unprotect

    This topic has been closed for replies.

    1 reply

    benderAuthor
    Visitor II
    August 30, 2006
    Posted on August 30, 2006 at 14:04

    Is anyone else having problems unprotecting flash?

    I am using the Keil MCBSTR7 Evaluation board and am having the following problem:

    If I add the following code at the start of the main function the only way I can get the chip to boot is to start it using the ULINK JATAG debugger.

    I have narrowed it down to the register write that starts the flash controller, writing a one to

    Bit 31 of the Flash Controller Register “DR0”. If I reset the board without the JATAG debugger running and then break into the system using the debugger the Undefined_Handler() function is constantly being called and the processor Mode is “Undefined”.

    This problem also occurs on an OUMEX development board, so it is not a board problem.

    Main()

    {

    //

    // Initialize the FLASH

    //

    FLASH_Init () ;

    FLASH_WaitForLastTask();

    /* Set the Set protection Bit */

    pFLASHR->CR0 |= FLASH_SPR_Mask;

    /* Set the Register Address */

    pFLASHR->AR = 0x4010DFB0;

    /* Data to be programmed to the Protection Register */

    pFLASHR->DR0 = FLASHPR->NVWPAR|FLASH_B1F1;

    /* Set the WMS bit to Start the Sequence */

    pFLASHR->CR0; |= FLASH_WMS_Mask

    }