2025-01-03 03:04 AM - edited 2025-01-03 09:30 AM
Hi community,
like the title says, I need your suggestions regarding firmware update via UART on an STM32F446RET6.
So I developed a product with the STM32F446RET6 chip. The only accessible protocol to my users is UART1, on which I implemented Modbus RTU with RS485.
Now the TX and RX pins of UART1 are converted to RS485 signal using this particular IC: MAX3485ESA, and the RS485+ and RS485- pins are exposed to the users.
Other than those, nothing else is accessible, no SWD nor Boot pins. I need to implement a firmware upgrading scheme based on this hardware, so from a computer through an RS485 transceiver, to the IC on the board, and then to UART1. I want to know whether this is possible, and if yes, please kindly give some suggestions on where to start.
Also, I wrote a GUI application for the product and in the future want to integrate the firmware upgrading functionality into the software, so no third-party app is needed. Is it that I would have to write my own bootloader to achieve this? Any recommendation or guides would be very much appreciated.
Thank you!
Edit: By "no SWD" I actually mean that the SWD interface is not as easily accessible for the users. They still exist on the board that I made, and yes during development I do use this with an ST-Link for debugging and flashing, but the way the product was designed makes it a bit inconvenient for non-developer users to flash new firmwares.
2025-01-03 04:39 AM
You'll either have to write your own bootloader or firmware update solution, or you will have to write code that jumps to the system bootloader upon request, assuming the UART pins you've exposed are supported by the bootloader.
Writing code to update itself will be tricky without a dual-bank chip, but it can be done. Perhaps look at open bootloader for inspiration.
How to use the ST Open Bootloader for STM32 Microc... - STMicroelectronics Community
I'd remake the board with SWD pins available as not having them will slow development and hinder debugging.
2025-01-03 06:42 AM
The Half-Duplex nature of the link does complicate things. How are you sending / receiving packets now? Can you extend that?
X-MODEM might work, you can tune the delays/turn-around
https://community.st.com/t5/stm32cubeprogrammer-mcus/rs485-half-duplex-bootloader/td-p/629877
2025-01-03 08:35 PM
There are some rs485 converter which implement automatic handling of ds/rs signals. You can try to see if your board can be programmed using cube programmer using the above technique. Use proper methods to put your board into boot loader mode. If the above is successful, then you can implement modbus packets which will trigger to put your board into bootloader mode in the customer location also.