cancel
Showing results for 
Search instead for 
Did you mean: 

Fun with Option Bytes

will2
Associate II
Posted on March 11, 2010 at 21:46

Fun with Option Bytes

3 REPLIES 3
Posted on May 17, 2011 at 15:07

Hi,

You should add:

// Define FLASH programming time 

FLASH_SetProgrammingTime(FLASH_PROGRAMTIME_STANDARD);

and just then:

FLASH_Unlock(FLASH_MEMTYPE_DATA);     // unlock data memory by passing the RASS key in the proper order

FLASH_ProgramOptionByte(0x4803,0x80);     // byte OPT2 resides at address x4803, write a 1 to bit 7.  This will also write to the NOPT2 complement byte

FLASH_Lock(FLASH_MEMTYPE_DATA);       // re-lock data memory

will2
Associate II
Posted on May 17, 2011 at 15:07

Hi,

Thanks for the feedback.  Unfortunately, this still doesn't work.  I added that line, built the project and went into debug - still no beeper.  Exit debug mode and the board resets - THEN I can get the beeper.  However, any subsequent attempt at entering debug mode generates the error ''Connection error (usb://usb): gdi-error[40701]: option bytes read error: not complemented; please use a programmer''

At this point, it seems hung up and I can't connect to the board.  I'm forced to go into STVP ''option byte'' tab, setting ROP to ON, write it, and then set ROP to OFF, and write it.  That will erase the entire flash area and allow me to re-establish a connection to the board.

I'll keep playing around with this....

mozra272
Associate II
Posted on May 17, 2011 at 15:07

Hi,

Can you please check this sequence :

FLASH_Unlock(FLASH_MEMTYPE_DATA);

while (FLASH_GetFlagStatus(FLASH_FLAG_DUL) ==RESET); 

FLASH_ProgramOptionByte(0x4803,0x80);   

FLASH_Lock(FLASH_MEMTYPE_DATA);

Thanks to keep us informed

Regards

mozra