Short version. How do I erase the option bytes on an STM10F103ZC using JTAG and Keil uVision IDE? I have tried Flash->Erase but it did not work. Details follow. I have taken an extremely rare prototype and turned into a brick. Any help would be appreciated.
I installed and ran the following code using the Keil uVision suit on a STM10F103ZC
// configure Read protection Lcd_Clear(); Lcd_WrStr("Boot Start"); TIME_Delay(TIME_1S * 2); if (FLASH_GetReadOutProtectionStatus() == RESET){ Lcd_Clear(); Lcd_WrStr("Setting Read Prot"); TIME_Delay (TIME_1S * 4); FLASH_Unlock(); FLASH_ReadOutProtection(ENABLE); SCB->AIRCR = 0x05FA0004; // send signal from Coretex core to external reset device while(1); // stall until reset occurs. JTAG will mask this request } else { Lcd_Clear(); Lcd_GotoXY(0,0); Lcd_WrStr("Read Prot On"); TIME_Delay (TIME_1S * 4); while(1); }
I got the "boot start" message followed by the "Setting Read Prot" message.
The chip reset and then I got "Read Prot On"
I then used chose Erase from the Flash menu on the Keil uVision IDE to bulk erase the chip. I assumed that includes the option bytes. But then when I went to reprogram so new code, I get two pop up messages boxes.
Flash Time out. Reset the device and try again then Error: Flash Download failed - "Cortex-M3"
I have tried adding code from a file called STM32F10xOPT.s which I found in C:\Keil\ARM\Boards\Keil\MCBSTM32\Blinky (an example program).
But even when I install this in my project, it does not work.
I have tried adding a program algorithm for option byte memory area, but it didn't help and the Blinky example doesn't do that.
-- derik