Skip to content

stm32_init bug #1

@nerdralph

Description

@nerdralph

The updated (and not consistently indented) code in stm32_init sends the autobaud 0x7F twice. The second gets misinterpreted as a command, throwing off the init sequence, and adding an unnecessary delay of the serial read timeout.
https://github.com/unwireddevices/stm32flash/blob/master/stm32.c#L420
Since the commands are sent in byte pairs, the bootloader receives the 2nd 0x7F as a start of a command pair, and stm32flash times out waiting for a response. When it times out, it sends another 0x7F, which results in a NAK response from the bootloader, and then stm32flash finally continues.

I've reverted to the version of stm32_init from the stm32duino fork, which fixes the bug.
https://github.com/nerdralph/stm32flash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions