I am attempting to update the application code on an STM32 chip programatically from another chip. I have an Intel format hex file generated from the build process and I would like to use the bootloader shipped with the STM32 chip for writing the updated application following AN3155. My question regards the format of the actual data in the Write Memory Command
- should this data be shipped as hex? i.e. when quoting the length - 16 bytes would be shipped as a 32-byte ascii representation?
\$\begingroup\$
\$\endgroup\$
Add a comment
|
1 Answer
\$\begingroup\$
\$\endgroup\$
2
Your own link specifies this as a binary protocol:
The host sends the bytes to the STM32 as follows:
Byte 1: 0x31
Byte 2: 0xCE
Wait for ACK
Byte 3 to byte 6:Start address (byte 3: MSB, byte 6: LSB)
Byte 7: Checksum: XOR (byte3, byte4, byte5, byte6)
Wait for ACK
Byte 8: Number of bytes to be received (0 < N ≤ 255)
N +1 data bytes:(Max 256 bytes)
Checksum byte:XOR (N, N+1 data bytes)
The contents of the binary packet are similar to a line in a hex file (or an amalgamation of several contiguous ones) but this is binary, not an ASCII-hex representation.
-
\$\begingroup\$ Awesome! Thanks for the response, Chris. So, all of the bytes written as a binary string then, i.e. (from above) Byte 1 = 1, Byte 2 = Î...etc etc? \$\endgroup\$– cirrusioCommented Apr 15, 2019 at 19:45
-
\$\begingroup\$ The bytes are defined in the document you linked you just create those packets and send them. \$\endgroup\$ Commented Apr 15, 2019 at 23:13