cancel
Showing results for 
Search instead for 
Did you mean: 

Permanent Unprotection

smartpocket
Associate II
Posted on January 12, 2006 at 09:48

Permanent Unprotection

5 REPLIES 5
smartpocket
Associate II
Posted on February 16, 2005 at 12:08

Hi to all

In ''Flash Programming Reference Manual'' you can read (par. 3.4):

''You can permanently unprotect a protected sector (write protect), or protected Flash Module (debug protect) [...] by programming PDSx bit . . . .''

a)

PROBLEM: writing the PSDx bit disable permanently the ''debug protection'' but NOT the ''sector write protection''

So, I cannot reload new F/W: is correct ?

:-[ . . . one chip is dead . . . :-[ :-[

b)

The ACCP bit in FLASH_NVAPR0 is disappeared. This implies that in new micro release it is unused: is correct ?

Bye

Smart

:-?

hichem2
Associate II
Posted on February 16, 2005 at 12:53

Hello smart, :-[

I'm sorry, but if you enable the Debug Protection of internal flash memory, then the code crashes. The device will always stay in Debug Protection mode! This means that this chip can't be used anymore because JTAG interface is disabled.

With regards,

Hich 8-)

smartpocket
Associate II
Posted on February 16, 2005 at 13:05

Hi Hich,

. . . i have implemented a USB bootloader and i can disable and reenable debug protection whit my specific commands . . . (up to 16 time...)

The problem is that sectors remains write protected . . .

Regards

Smart

:-?

smartpocket
Associate II
Posted on February 17, 2005 at 03:51

This is the situation:

- B0F0..B0F4 -->> ProgramA

- the first time ProgramA load ProgramB in B0F5..B0F7, activate WriteProtection on all sector and activate Debug Protection

- ProgramA can erase WP, load a new Program and write it in B0F5..B0F7

- ProgramA can enable or disable Debug protection and write protection

The problem is that your data sheet write that is possible PERMANENTLY UNPROTECT A WRITE PROTECTED SECTOR by resetting bit PDSx: it is false !!

-->> I cannot rewrite ProgramA by JTAG (I can only if Program B can disable WP and load and write the new ProgramA !!!)

Regards

smart

🙂

shangdawei1
Associate II
Posted on January 12, 2006 at 09:48

Quote:

On 17-02-2005 at 10:37, Anonymous wrote:

smart,

I propose fo you to

- Load a program to B0F5..B0F7 to disable the DEBUG protection.

- Connect to the micro, Write a program which disable the WP, and run it from RAM.

- Open your prject ''USB bootloader'' WITHOUT RESETTING THE MICRO and load it to the flash

Best regards,

 

can ''USB bootloader'' not disable the WP (because it is in B0) ?

''- Load a program to B0F5..B0F7 to disable the DEBUG protection.''

in FLASH PROGRAMMING REFERENCE MANUAL

3.6 SET PROTECTION EXAMPLES

Example 3: Disable Debug Protection permanently.

FLASH_CR0 |= 0x01000000; /*Set SPR in FLASH_CR0*/

FLASH_AR = 0x0010DFBC; /*Load Add in FLASH_AR*/

FLASH_DR0 = 0xFFFFFFFE; /*Load Data in FLASH_DR0*/

FLASH_CR0 |= 0x80000000; /*Operation start*/

Example 4: Re-Enable Debug Protection permanently, after having disabled it.

FLASH_CR0 |= 0x01000000; /*Set SPR in FLASH_CR0*/

FLASH_AR = 0x0010DFBC; /*Load Add in FLASH_AR*/

FLASH_DR0 = 0xFFFEFFFE; /*Load Data in FLASH_DR0*/

FLASH_CR0 |= 0x80000000; /*Operation start*/

Note You can disable and re-enable the Debug Protection permanently (as shown in

examples 3 and 4) a maximum of 16 times.

 

Note These examples can only be done by code which is fetched from RAM.

3.4 PERMANENT UNPROTECTION

You can permanently unprotect a protected sector (write protect), or protected Flash Module

(debug protect). You may need to use this feature under certain circumstances, for example to

analyze rejects. Debug protection can be disabled by programming the PDSx bits in the

FLASH_NVAPR1 register. If the DBGP bit is programmed to 0, disabling the protection

by programming the PDSx bits can be done only by a program executed from the Flash Module.

The user software design can ensure that this is accessible only to authorized users.

is Code in RAM or Flash ?