2006-01-22 01:32 AM
How to permanently unprotect a protected Flash Module(debug protect) ?
2006-01-11 09:44 PM
see : STR7 FAMILY FLASH PROGRAMMING REFERENCE MANUAL
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. 3.6 SET PROTECTION EXAMPLES Example 1: Enable Write Protection of sectors B0F3-0 of Bank 0 in the Flash Module. FLASH_CR0 |= 0x01000000; /*Set SPR in FLASH_CR0*/ FLASH_AR = 0x0010DFB0; /*Load Add in FLASH_AR*/ FLASH_DR0 = 0xFFFFFFF0; /*Load Data in FLASH_DR0*/ FLASH_CR0 |= 0x80000000; /*Operation start*/ Example 2: Enable Debug Protection. FLASH_CR0 |= 0x01000000; /*Set SPR in FLASH_CR0*/ FLASH_AR = 0x0010DFB8; /*Load Add in FLASH_AR*/ FLASH_DR0 = 0xFFFFFFFD; /*Load Data in FLASH_DR0*/ FLASH_CR0 |= 0x80000000; /*Operation start*/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. does program code execute from the Flash Module or fetch from RAM ?
2006-01-12 08:25 PM
Hello,
You right, its a mistake on the STR7 Flash programming reference manual: - The write protection can not be disabled in a permanent way, it can be disabled only in a temporary way. The code to Enable/Disable the write protection can be fetched either from RAM or Flash. - The Debug protection can be Enabled with code fetched either from RAM or FLASH. - The Debug protection can be disabled with code fetched only from FLASH. A new version of the STR7 FLASH PROGRAMMING MANUAL will be available on the STMCU website. Regards.2006-01-12 08:52 PM
Quote:
On 13-01-2006 at 09:55, Anonymous wrote: Hello, - The Debug protection can be disabled with code fetched only from FLASH. To be disabled Debug protection, PDSx has to be programmed to '0', you mean, i can program FLASH_NVAPR1 from BANK0 ? BTW, my MSN is shangdawei AT 371.net, how can i contact you directly ?2006-01-12 09:23 PM
Quote:
On 13-01-2006 at 09:55, Anonymous wrote: Hello, A new version of the STR7 FLASH PROGRAMMING MANUAL will be available on the STMCU website. Regards. When can i get it ? I need it urgent.2006-01-13 01:41 AM
yes you can can program FLASH_NVAPR1 from BANK0 and the new version of the STR7 Flash programming manual will be available next week.
Regards.2006-01-17 10:33 AM
Now i downloaded newer FLASH PROGRAMMING REFERENCE MANUAL V3.
in FLASH PROGRAMMING REFERENCE MANUAL V3 : WRITE PROTECTIONThe Flash module provides a write protection, which can be independently activated for each sector of each bank. When a sector is Write Protected, any attempt to program or erase will result in a Protection Error. A flash sector can be Write Protected by programming at 0 the related bit WyPx of the FLASH_NVWPAR register. Note The Write protection operation can be executed from all the internal/external memories including Flash Bank 0 of the Flash module. Q1: does it means Flash B0, Flash B1,RAM, Ext. mem ?DEBUG PROTECTIONIf bit DBGP of FLASH_NVAPR0 is programmed at 0, the device becomes Debug protected: debug features JTAG pins and Flash SystemMemory mode are disabled. Note The Debug protection operation can be executed from all the internal/external memories except Flash Bank 0 of the Flash module. Q2: does it means Flash B1,RAM, Ext. mem except Flash B0 ?Temporary Unprotection - A write protected sectorA write protected sector can be temporarily unprotected by executing the set protection operation and writing 1 in the associated WyPx bits of FLASH_NVWPAR. Refer to Section 3.5 for examples. The temporary unprotection write operation can be executed from all the internal/external memories including Flash Bank 0 of the Flash module. Q3: A write protected sector can be temporarily unprotected can be finished from internal RAM or Flash B0 or Flash B1 or Ext. Mem ?Temporary Unprotection - The debug protected FlashThe debug protected Flash module can be temporarily unprotected by executing the set protection operation and writing 1 into this DBGP bit but only if these instructions are executed from the Flash Module. Permanent Unprotection - The debug protected FlashIf 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. Q4: debug protection can be temporarily or premanent unprotected only when a program executed from the Flash Module (B0 or B1) ?Q5: Re-Enable Debug Protection permanently, after having disabled it.
where does a program executes from? Only Flash B1?in FLASH PROGRAMMING REFERENCE MANUAL V2 Page 23 : Trying to write into the Debug Protected Flash from internal RAM will be unsuccessful.and in V3 it is removed. does it mean Q6: the Debug Protected Flash can be wrote from internal RAM or Flash B0/B1 or Ext. Mem ?
2006-01-17 11:03 PM
Hello,
Q1: does it means Flash B0, Flash B1,RAM, Ext. mem? R1: Yes. Q2: does it means Flash B1,RAM, Ext. mem except Flash B0 ? R2: Yes. Q3: A write protected sector can be temporarily unprotected can be finished from internal RAM or Flash B0 or Flash B1 or Ext. Mem ? R3: The write protection can be temporarily unprotected form all the memory areas (internal RAM or Flash B0 or Flash B1 or Ext). Q4: debug protection can be temporarily or premanent unprotected only when a program executed from the Flash Module (B0 or B1) ? R4: Yes. Q5: Re-Enable Debug Protection permanently, after having disabled it. where does a program executes from? Only Flash B1? R5: from all the internal/external memories except Flash Bank 0 of the Flash module. Q6: the Debug Protected Flash can be wrote from internal RAM or Flash B0/B1 or Ext. Mem ? R6: Yes a Debug Protected Flash can be wrote from Internal RAM, or from Ext. Mem if enabled. Because when Debug protection is enabled the EMI is disabled automatically, but it can be enabled again if the user application allows it. Best regards.2006-01-22 01:32 AM
Thx Bouha, now all are clear !