SN32F260 Series
32-Bit Cortex-M0 Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 121
Version 1.5
11.8.2 PROGRAM FLASH MEMORY
The Flash memory can be programmed 1 page (64 bytes) at a time. CPU can program the main Flash memory by
performing standard page write operations. The PG bit in the FLASH_CTRL register must be set. When the data is
filled in the FLASH _DATA register, FMC preliminarily increases the data address, and checks the address to be
programmed. If the following errors happen, the program operation is skipped and a warning is issued by the PGERR
bit in FLASH_STATUS register.
- Start to Erase/Program and find that the address is over page boundary.
- Start to Erase/Program and find that the address is illegal. (>ROM size)
- Fill in Data and the address is already over Page Boundary.
The main Flash memory programming sequence in standard mode is as follows:
1. Set the PG bit in the FLASH_CTRL register.
2. Fill in the target address in the FLASH_ADDR register.
3. Wait for the BUSY bit to be reset.
4. Perform the continuous data write until all of the data had been filled in the FLASH_DATA register.
5. Wait for the BUSY bit to be reset.
6. Set the START bit to start programming.
7. Wait for the BUSY bit to be reset.
8. (Optional) Read the programmed value and verify.
11.8.3 ERASE
The Flash memory can be erased page by page.
11.8.3.1 PAGE ERASE
A page of the Flash memory can be erased using the Page Erase feature of the FMC. To erase a page, the procedure
below should be followed:
1.
Set the PER bit in the FLASH_CTRL register.
2.
Program the FLASH_ADDR register to select a page to be erased
3.
Set the STARTE bit in the FLASH_CTRL register..
4.
Wait for the BUSY bit to be reset.
5.
(Optional) Read the erased page and verify.
11.8.3.2 MASS ERASE
When the Flash memory read protection is changed from protected to unprotected, a Mass Erase of the User ROM is
performed by HW before reprogramming the read protection option.
11.9 READ PROTECTION
The read protection is activated by setting the Code Security bytes in Code option.
When the Flash memory read protection is changed from protected to unprotected, a Mass Erase of the User ROM is
performed by HW before reprogramming the read protection option.
11.10 HW CHECKSUM
HW checksum is the checksum of User ROM. If the read protection is enabled, the users can still readout the HW
checksum through Writer or ISP AP.