2024-02-14 04:57 PM
I am trying to create a uart flash loader program.
Currently, the stm32f103rct6 chip is being used, and cp201x is being used for serial communication with the PC.
1. Successfully downloaded bootload and application code using existing bootload mode with UART (CubeProgrammer).
2. I succeeded in uploading the code to the board using IAP (In-application programming) mode with uart.
However, IAP mode requires the use of the ymodem protocol and is inconvenient from the user's perspective.
Based on these
After uploading the bootloader, I would like to create a simple, custom UART Flash Loader program instead of CubeProgrammer. Are there any materials or methods that I can refer to?
Thanks,
2024-02-14 05:19 PM
What part do you need help with?
UART bootloader protocol is detailed in AN3155.
Using a serial port from Python, for example, should have a ton of hits online. Similar for other languages. Here is one link of many:
https://www.tutorialspoint.com/how-do-i-access-the-serial-rs232-port-in-python
2024-02-14 07:09 PM
What languages and windowing environments are you comfortable with?
There are several examples of programming via the serial port, but the protocol isn't particularly burdensome.
The IAP could presumably use some more common protocol like X-MODEM / Y-MODEM
2024-02-14 09:21 PM
Why so complicated?
As I know, many of the STM MCUs provide a bootloader via UART: check the pin config table and often it says: if you close BOOT pin (tied high, not default to ground), there is one UART (e.g. UART1 pins, besides other options like SPI, I2C, even USB) to activate the bootloader (R/O in chip), so that you can flash MCU via UART (STM32CureeProgrammer should see which bootloader device is active, when BOOT pin is tied high).
Other option: I guess, you can call the bootloader from your own code (no need to have a jumper on BOOT). I assume, the bootloader activated now, will check all the (BOOT) config options (SPI, UART, I2C, USB), if a host device is cannot there. Just check what is mentioned as "boot pin".
If you want to implement your own bootloader procedure: it can be very tricky:
Try to understand how the Bootloader in STM MCU work, how to use the features already provided (e.g. via this BOOT pin).
At least: call the internal bootloader provided. Do not try to provide your own bootloader when you are still running at the same memory which you want to program when "still in use" (it cannot work).
2024-03-18 05:47 PM
Thank you for relpy.
I think it'll be easy enough if you do it the way you said it
But the HW system is already built and the goal is to modify and develop it.
Thank you.
2024-03-18 05:48 PM
I'll refer to it and proceed with it.
thank you
2024-03-18 05:49 PM
It's the same thing that most of the samples said. Thank you.