Bootloader command set
AN3154
Doc ID 17063 Rev 1
3.10
Write Protect command
The Write Protect command is used to enable the write protection for some or all Flash
memory sectors. When the bootloader receives the Write Protect command, it transmits the
ACK message to the host if ROP is disabled else it transmits NACK.
After the transmission of the ACK byte, the bootloader waits to receive the Flash memory
sector codes from the application.
At the end of the Write Protect command, the bootloader transmits the ACK message and
generates a system Reset to take into account the new configuration of the option byte.
Note:
1
Refer to
Section 3.1: Device-dependent bootloader parameters
for more details about the
sector size for the device you are using.
2
The total number of sectors and the sector number to be protected are not checked, this
means that no error is returned when a command is passed with a wrong number of sectors
to be protected or a wrong sector number.
If a second Write Protect command is executed, the Flash memory sectors that were
protected by the first command become unprotected and only the sectors passed within the
second Write Protect command become protected.
Figure 20.
Write Protect command: host side
1.
WP = Write Protect.
The host sends messages as follows:
Command message: Std ID = 0x63, DLC = 0x01, data[0] = N (where 0 < N
255).
Command message: Std ID = 0x63, DLC = 0x01..08, data[0] = N (where 0 < N
255).
7AITFOR!#+
OR.!#+
7AITFOR!#+
OR.!#+
%NDOF70
.!#+
!#+
AI
3ENDWRITEPROTECTMESSAGESTD)$X
3TART70
3ENDMESSAGEWITHTHESECTORCODESAND
THENUMBEROFSECTORSTOBEPROTECTED
.!#+
!#+