BPROT — Block protection

The mechanism for protecting non-volatile memory can be used to prevent application code from erasing or writing to protected blocks.

Non-volatile memory can be protected from erases and writes depending on the settings in the CONFIG registers. One bit in a CONFIG register represents one protected block of 4 kB. There are four CONFIG registers of 32 bits, which means there are 128 protectable blocks in total.

Important: If an erase or write to a protected block is detected, the CPU will hard fault. If an ERASEALL operation is attempted from the CPU while any block is protected, it will be blocked and the CPU will hard fault.

On reset, all the protection bits are cleared. To ensure safe operation, the first task after reset must be to set the protection bits. The only way of clearing protection bits is by resetting the device from any reset source.

The protection mechanism is turned off when in debug interface mode (a debugger is connected) and the DISABLEINDEBUG register is set to disable. For more information, see Debug and trace.

Figure 1. Protected regions of program memory

Registers

Table 1. Instances
Base addressPeripheralInstanceDescriptionConfiguration
0x40000000BPROTBPROTBlock Protect  
Table 2. Register Overview
RegisterOffsetDescription
CONFIG00x600Block protect configuration register 0 
CONFIG10x604Block protect configuration register 1 
DISABLEINDEBUG0x608Disable protection mechanism in debug interface mode 
 0x60C Reserved
CONFIG20x610Block protect configuration register 2 
CONFIG30x614Block protect configuration register 3 

CONFIG0

Address offset: 0x600

Block protect configuration register 0

Bit number313029282726252423222120191817161514131211109876543210
IdfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
Reset 0x0000000000000000000000000000000000000000
IdRWFieldValue IdValueDescription
ARWREGION0  Enable protection for region 0. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
BRWREGION1  Enable protection for region 1. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
CRWREGION2  Enable protection for region 2. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
DRWREGION3  Enable protection for region 3. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
ERWREGION4  Enable protection for region 4. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
FRWREGION5  Enable protection for region 5. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
GRWREGION6  Enable protection for region 6. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
HRWREGION7  Enable protection for region 7. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
IRWREGION8  Enable protection for region 8. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
JRWREGION9  Enable protection for region 9. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
KRWREGION10  Enable protection for region 10. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
LRWREGION11  Enable protection for region 11. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
MRWREGION12  Enable protection for region 12. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
NRWREGION13  Enable protection for region 13. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
ORWREGION14  Enable protection for region 14. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
PRWREGION15  Enable protection for region 15. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
QRWREGION16  Enable protection for region 16. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
RRWREGION17  Enable protection for region 17. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
SRWREGION18  Enable protection for region 18. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
TRWREGION19  Enable protection for region 19. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
URWREGION20  Enable protection for region 20. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
VRWREGION21  Enable protection for region 21. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
WRWREGION22  Enable protection for region 22. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
XRWREGION23  Enable protection for region 23. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
YRWREGION24  Enable protection for region 24. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
ZRWREGION25  Enable protection for region 25. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
aRWREGION26  Enable protection for region 26. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
bRWREGION27  Enable protection for region 27. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
cRWREGION28  Enable protection for region 28. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
dRWREGION29  Enable protection for region 29. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
eRWREGION30  Enable protection for region 30. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
fRWREGION31  Enable protection for region 31. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enable
 

CONFIG1

Address offset: 0x604

Block protect configuration register 1

Bit number313029282726252423222120191817161514131211109876543210
IdfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
Reset 0x0000000000000000000000000000000000000000
IdRWFieldValue IdValueDescription
ARWREGION32  Enable protection for region 32. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
BRWREGION33  Enable protection for region 33. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
CRWREGION34  Enable protection for region 34. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
DRWREGION35  Enable protection for region 35. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
ERWREGION36  Enable protection for region 36. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
FRWREGION37  Enable protection for region 37. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
GRWREGION38  Enable protection for region 38. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
HRWREGION39  Enable protection for region 39. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
IRWREGION40  Enable protection for region 40. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
JRWREGION41  Enable protection for region 41. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
KRWREGION42  Enable protection for region 42. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
LRWREGION43  Enable protection for region 43. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
MRWREGION44  Enable protection for region 44. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
NRWREGION45  Enable protection for region 45. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
ORWREGION46  Enable protection for region 46. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
PRWREGION47  Enable protection for region 47. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
QRWREGION48  Enable protection for region 48. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
RRWREGION49  Enable protection for region 49. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
SRWREGION50  Enable protection for region 50. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
TRWREGION51  Enable protection for region 51. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
URWREGION52  Enable protection for region 52. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
VRWREGION53  Enable protection for region 53. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
WRWREGION54  Enable protection for region 54. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
XRWREGION55  Enable protection for region 55. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
YRWREGION56  Enable protection for region 56. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
ZRWREGION57  Enable protection for region 57. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
aRWREGION58  Enable protection for region 58. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
bRWREGION59  Enable protection for region 59. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
cRWREGION60  Enable protection for region 60. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
dRWREGION61  Enable protection for region 61. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
eRWREGION62  Enable protection for region 62. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
fRWREGION63  Enable protection for region 63. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
 

DISABLEINDEBUG

Address offset: 0x608

Disable protection mechanism in debug interface mode

Bit number313029282726252423222120191817161514131211109876543210
Id                               A
Reset 0x0000000100000000000000000000000000000001
IdRWFieldValue IdValueDescription
ARWDISABLEINDEBUG  Disable the protection mechanism for NVM regions while in debug interface mode. This register will only disable the protection mechanism if the device is in debug interface mode.
   Disabled1Disable in debug
   Enabled0Enable in debug
 

CONFIG2

Address offset: 0x610

Block protect configuration register 2

Bit number313029282726252423222120191817161514131211109876543210
IdfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
Reset 0x0000000000000000000000000000000000000000
IdRWFieldValue IdValueDescription
ARWREGION64  Enable protection for region 64. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
BRWREGION65  Enable protection for region 65. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
CRWREGION66  Enable protection for region 66. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
DRWREGION67  Enable protection for region 67. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
ERWREGION68  Enable protection for region 68. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
FRWREGION69  Enable protection for region 69. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
GRWREGION70  Enable protection for region 70. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
HRWREGION71  Enable protection for region 71. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
IRWREGION72  Enable protection for region 72. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
JRWREGION73  Enable protection for region 73. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
KRWREGION74  Enable protection for region 74. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
LRWREGION75  Enable protection for region 75. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
MRWREGION76  Enable protection for region 76. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
NRWREGION77  Enable protection for region 77. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
ORWREGION78  Enable protection for region 78. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
PRWREGION79  Enable protection for region 79. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
QRWREGION80  Enable protection for region 80. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
RRWREGION81  Enable protection for region 81. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
SRWREGION82  Enable protection for region 82. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
TRWREGION83  Enable protection for region 83. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
URWREGION84  Enable protection for region 84. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
VRWREGION85  Enable protection for region 85. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
WRWREGION86  Enable protection for region 86. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
XRWREGION87  Enable protection for region 87. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
YRWREGION88  Enable protection for region 88. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
ZRWREGION89  Enable protection for region 89. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
aRWREGION90  Enable protection for region 90. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
bRWREGION91  Enable protection for region 91. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
cRWREGION92  Enable protection for region 92. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
dRWREGION93  Enable protection for region 93. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
eRWREGION94  Enable protection for region 94. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
fRWREGION95  Enable protection for region 95. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
 

CONFIG3

Address offset: 0x614

Block protect configuration register 3

Bit number313029282726252423222120191817161514131211109876543210
IdfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
Reset 0x0000000000000000000000000000000000000000
IdRWFieldValue IdValueDescription
ARWREGION96  Enable protection for region 96. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
BRWREGION97  Enable protection for region 97. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
CRWREGION98  Enable protection for region 98. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
DRWREGION99  Enable protection for region 99. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
ERWREGION100  Enable protection for region 100. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
FRWREGION101  Enable protection for region 101. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
GRWREGION102  Enable protection for region 102. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
HRWREGION103  Enable protection for region 103. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
IRWREGION104  Enable protection for region 104. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
JRWREGION105  Enable protection for region 105. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
KRWREGION106  Enable protection for region 106. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
LRWREGION107  Enable protection for region 107. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
MRWREGION108  Enable protection for region 108. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
NRWREGION109  Enable protection for region 109. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
ORWREGION110  Enable protection for region 110. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
PRWREGION111  Enable protection for region 111. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
QRWREGION112  Enable protection for region 112. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
RRWREGION113  Enable protection for region 113. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
SRWREGION114  Enable protection for region 114. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
TRWREGION115  Enable protection for region 115. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
URWREGION116  Enable protection for region 116. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
VRWREGION117  Enable protection for region 117. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
WRWREGION118  Enable protection for region 118. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
XRWREGION119  Enable protection for region 119. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
YRWREGION120  Enable protection for region 120. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
ZRWREGION121  Enable protection for region 121. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
aRWREGION122  Enable protection for region 122. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
bRWREGION123  Enable protection for region 123. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
cRWREGION124  Enable protection for region 124. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
dRWREGION125  Enable protection for region 125. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
eRWREGION126  Enable protection for region 126. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled
fRWREGION127  Enable protection for region 127. Write '0' has no effect.
   Disabled0Protection disabled
   Enabled1Protection enabled