26.6.1 Control B

Name: CTRLB
Offset: 0x04
Reset: 0x00000000
Property: Local Write-Protection

Bit 3130292827262524 
          
Access  
Reset  
Bit 2322212019181716 
          
Access  
Reset  
Bit 15141312111098 
 CMDEX[7:0] 
Access R/WR/WR/WR/WR/WR/WR/WR/W 
Reset 00000000 
Bit 76543210 
  CMD[6:0] 
Access R/WR/WR/WR/WR/WR/WR/W 
Reset 0000000 

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.

ValueNameDescription
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 other commands enable an erase or write operation. The operation is started by performing a store to the address location.

Between issuing new commands, always issue a NOCMD or NOOP command. If an attempt is made to issue a command while the Flash is busy, STATUS.PROGE is set.

ValueNameDescription
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 = ‘0x2’ (debugger has unrestricted access)

Other — Reserved