AN2662
Figure 39. Go command via CAN: Device side
The STM32F105xx and STM32F107xx sends the messages as follows:
ACK message: Std ID = 0x21, DLC = 1, data[0] = ACK if content of the command is correct
else data[0] = NACK
3.10
Write Memory command via CAN
The Write Memory command is used to write data to any memory address of RAM starting
from 0x2000 1000, Flash memory, or Option byte area. Refer to the STM32F10xxx Flash
programming manual (PM0042). When the bootloader receives the Write Memory
command, (message with 5 bytes data length, data[0] is the address MSB, data[3] is the
LSB and data[4] is the number of data bytes to be received), it then checks the received
address. For the Option byte area, the start address must be 0x1FFFF800 to avoid writing
unintentionally in this area.
If the received address is valid, the bootloader transmits an ACK message, otherwise it
transmits a NACK message and aborts the command. When the address is valid, the
bootloader:
●
Receives the user data ((N + 1) bytes) so the device receive (N + 1)/8 messages (each
message contains 8 data bytes)
●
Programs the user data into memory starting from the received address
●
At the end of the command, if the write operation was successful, the bootloader
transmits the ACK message; otherwise it transmits a NACK message to the user and
aborts the command
The maximum length of the block to be written for the STM32F105xx and STM32F107xx is
256 bytes.
If the Write Memory command is issued to the Option byte area, all options are erased
before writing the new values, and at the end of the command the bootloader generates a
system Reset to take into account the new configuration of the option byte.
Doc ID 14156 Rev 1
CAN bootloader
53/83
Need help?
Do you have a question about the STM32F105 Series and is the answer not in the manual?