26.6.1 Control B
| Name: | CTRLB |
| Offset: | 0x04 |
| Reset: | 0x00000000 |
| Property: | Local Write-Protection |
| Bit | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | |
| Access | |||||||||
| Reset |
| Bit | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | |
| Access | |||||||||
| Reset |
| Bit | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | |
| CMDEX[7:0] | |||||||||
| Access | R/W | R/W | R/W | R/W | R/W | R/W | R/W | R/W | |
| Reset | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
| CMD[6:0] | |||||||||
| Access | R/W | R/W | R/W | R/W | R/W | R/W | R/W | ||
| Reset | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||
Bits 15:8 – CMDEX[7:0] Command Execution
When this bit field is written with the key value 0xA5, the command written to
the Command bit field in the Control B register (CTRLB.CMD) will be executed. If
a value different from the key value is used, the write will not be performed,
and the Programming Error bit in the Status register (STATUS.PROGE) will be set.
STATUS.PROGE is also set if a previously written command has not yet
completed.
The key value must be written at the same time as CTRLB.CMD. If a command is issued through the APB bus on the same cycle as an AHB bus access, the AHB bus access will be given priority. The command will then be executed when both the NVM block and the AHB bus are idle.
The Ready flag in the Interrupt Flag Status and Clear register (INTFLAG.READY) must be '1' when the command is issued.
Bit 0 of the CTRLB.CMDEX bit field will read back as '1' until the command is issued.
| Value | Name | Description |
|---|---|---|
| 0xA5 | KEY | Execution key |
| Other | — | Reserved |
Bits 6:0 – CMD[6:0] Command
This bit field defines the command to be executed when the correct key is written to the Command Execution bit field in the Command register (CTRLB.CMDEX). Write to this bit field to enable or issue a command. The Chip Erase command is started when the command is written. The others enable an erase or write operation. The operation is started by performing a store to the address location. A change from one command to another should always go through NOCMD or NOOP. If an attempt is made to write a programming command while the Flash is busy, STATUS.PROGE is set.
| Value | Name | Description |
|---|---|---|
| 0x00 | NOCMD | No command |
| 0x01 | NOOP | No operation |
| 0x02 | FLWR | Flash Write Enable |
| 0x08 | FLPER | Flash Page Erase Enable |
| 0x09 | FLMPER2 | Flash 2-page Erase Enable |
| 0x0A | FLMPER4 | Flash 4-page Erase Enable |
| 0x0B | FLMPER8 | Flash 8-page Erase Enable |
| 0x0C | FLMPER16 | Flash 16-page Erase Enable |
| 0x0D | FLMPER32 | Flash 32-page Erase Enable |
| 0x0E | LR | Lock Region. Sets the bit in the Region n Lock Bits bit field in the Lock Section register (NVMCTRL.LOCK) corresponding to the address location in the ADDR register. |
| 0x0F | UR | Unlock Region. Clears the bit in NVMCTRL.LOCK corresponding to the address location in the ADDR register. |
| 0x10 | EBOOTCFG | Erase BOOTCFG Page Enable |
| 0x11 | WBOOTCFG | Write BOOTCFG Page Enable |
| 0x12 | WLOCKREGION | Write Enable to ROMCFG.NVMLOCKREGION. Writes to other addresses will cause STATUS.PROGE to be set. |
| 0x20 | WROMCFG | Write ROMCFG Page Enable. The ROMCFG Page is used by the boot ROM to store Debug Access Level (DAL) bits and other security or protection bits for such as CEHL and Immutable boot. |
| 0x21 | CHER | Erase Flash Requires DAL == 2 or SYSINT privileges |
| Other | — | Reserved |
