0
\$\begingroup\$

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?

Chris Stratton
33.8k3 gold badges45 silver badges92 bronze badges
asked Apr 15, 2019 at 18:52
\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

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.

answered Apr 15, 2019 at 18:57
\$\endgroup\$
2
  • \$\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\$ Commented 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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.