2006-08-30 08:38 PM
2006-08-30 05:04 AM
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 }