Skip to main content
Visitor II
August 24, 2021
Solved

STM8AF Bootloader CAN write memory.

  • August 24, 2021
  • 1 reply
  • 1139 views

I'm trying to write a program to the microcontroller through the bootloader via the СAN interface.

  1. First I pass message ID 0x7f to activate bootloader. (ID=0x02, data=0x79)
  2. Then I transfer the file "E_W_ROUTINEs_128K_ver_2.0.s19" in binary form to address 0x000000A0 to enable write and erase commands. I transfer in blocks of 128 bytes. After transferring each block, I transmit the checksum and receive a positive response from the bootloader (ID=0x02, data=0x79)
  3. Then I send a command (ID 0x43) to erase all FLASH memory and EEPROM and specify 0xFF in the first byte. (I get 2 positive answers 0x79)
  4. Then I try to transfer the file of the new program to address 0x00008000 in the same way as the file "E_W_ROUTINEs_128K_ver_2.0", but after sending the first block of 128 bytes with a checksum, the bootloader does not respond.

I cannot understand why the bootloader does not respond to an attempt to write to address 0x00008000. When a command with the ID 0x31 is sent with the address and the number of bytes, a positive response is received from the bootloader (ID=0x02, data=0x79). But after sending the first block of data (128 bytes) the bootloader does not respond..

    This topic has been closed for replies.
    Best answer by MR.9

    Solved a problem.

    There was an error in the algorithm for writing to the microcontroller's memory.

    1 reply

    MR.9AuthorAnswer
    Visitor II
    August 25, 2021

    Solved a problem.

    There was an error in the algorithm for writing to the microcontroller's memory.