Page Erase/Program Protection. Holtek HT32F5828

Add to My manuals
637 Pages

advertisement

Page Erase/Program Protection. Holtek HT32F5828 | Manualzz

32-Bit Arm ®

HT32F5828

Cortex ® -M0+ MCU

Page Erase/Program Protection

The FMC provides a page erase/program protection function to prevent unexpected operations on the protected Flash memory area. The page erase (CMD [3:0] = 0x8 in the OCMR register) or word programming (CMD [3:0] = 0x4) command will not be accepted by the FMC on the protected pages. When the page erase or word programming command aimed at the protected pages is sent to the FMC, the PPEF bit in the OISR register will then be set by the FMC and the Flash Operation

Error interrupt will be triggered to inform the CPU if the OREIEN bit in the OIER register is set.

The page protection function can be individually enabled for each page by configuring the OB_

PP registers in the Option Byte area. The following table shows the access permission of the main

Flash page when the page protection is enabled.

Table 8. Access Permission of Protected Main Flash Page

Operation

Read

Program

Page Erase

Mass Erase

Mode

ISP/IAP

X

O

O

X

ICP/Debug Mode

X

O

O

X

Notes: 1. Each write protection bit setting is for one specific page. The above access permission only affects the pages of which the protection function has been enabled. Other pages are not affected.

2. The main Flash page protection is configured by OB_PP [127:0]. Option Byte is physically located at the last page of the main Flash. The Option Byte page protection is configured by the OB_CP [1] bit.

3. The page erase operation on the Option Byte area can disable the page protection of the main Flash.

4. The page protection of the Option Byte can only be disabled by a mass erase operation.

The following steps show the register access sequence for the page erase/program protection procedure.

1. Check the OPCR register to confirm that no Flash memory operation is in progress (OPM [3:0] is equal to 0xE or 0x6). Otherwise, wait until the previous operation has been finished.

2. Write the OB_PP address to the TADR register (Set TADR = 0x1FF0_0000).

3. Write the desired data, which indicates the protection function of the corresponding page is to be enabled or disabled, into the WRDR register (0: Enabled, 1: Disabled).

4. Write the word programming command to the OCMR register (Set CMD [3:0] = 0x4).

5. Commit the word programming command to the FMC by setting the OPCR register (Set OPM [3:0]

= 0xA).

6. Wait until all the operations have been finished by checking the value of the OPCR register (OPM [3:0] is equal to 0xE).

7. Read and verify the Option Byte if required.

8. The OB_CK field in the Option Byte area must be updated according to the Option Byte checksum rule.

9. Apply a system reset to activate the new OB_PP setting.

Rev. 1.00 51 of 637 December 28, 2020

advertisement

Related manuals

advertisement

Table of contents