Page 1 of 1

Micropyhton Method to program an STM32 connected

Posted: Thu Dec 02, 2021 4:39 pm
by o_eoin
I have a PCB with an STM32H7 that runs micropyhton, there is a second STM32 on the PCB and I would like to be able to program from the H7 processor running MP. I have access to the second STM32 over the native UART bootloader and the SWD pins.

In Linux for example I use a tool called stm32flash that programs an STM32 over UART + BOOT+RST using the factory ROM bootloader of the STM32.

Does anybody know if there is a solution for this in Micropython? The options are native STM bootloader over UART or some kind of bit-bashing on the SWD pins.

Re: Micropyhton Method to program an STM32 connected

Posted: Thu Dec 02, 2021 11:43 pm
by dhylands
The source code for stm32flash can be found here: https://github.com/stm32duino/stm32flash

This code is intended for the host and has way more functionality than you need, so you'd need to extract/modify it to do what you want.

The bootloader protocol is described in this document: https://www.st.com/resource/en/applicat ... ronics.pdf and it's simple enough you can probably just implement what you need in micropython.

Re: Micropyhton Method to program an STM32 connected

Posted: Fri Dec 03, 2021 8:22 am
by o_eoin
I use this already like I said, but how can I do it from micropython?

Re: Micropyhton Method to program an STM32 connected

Posted: Fri Dec 03, 2021 8:27 am
by o_eoin
Is there an existing Micropython module or library that can do this? I do not know how to compile C into micropython