2019-04-07 10:11 PM
In our product, a raspberry pi 3 is connected to an STM32 MCU of F series. I want to update the code that is running on STM using the raspberry pi. How can I do that? I basically want to perform OTA update on the code of STM MCU using the raspberry pi.
Its really urgent.
Kindly help.
Thanks in advance
Siddharth Soni
2019-04-07 10:18 PM
The STM32 have a ROM base loader whose UART protocol is well documented.
If you have your own loader on the parts, you can implement something more exotic.
2019-04-07 11:15 PM
Thanks for the reply, Clive Two.Zero. Can you please share the link to the documentation? And what do you exactly mean by own loader on the parts? What would be the exact procedure for burning the code? Why is the involvement of loader necessary in implementing the OTA?
Thanks.
Siddharth Soni
2019-04-07 11:36 PM
AN2606 and AN3155 as I recall. Try Googling STM32 USART protocol.
How's OTA going to magically get firmware into the device? Loader software in some form is going to have to provide a conduit. You're going to have to code one or both ends of the transaction.
2019-04-07 11:50 PM
Thanks buddy. Does ST Link too use the loader to upload the code too? And what do you mean by "You're going to have to code one or both ends of the transaction."? Are you referring to the STM end and Raspberry Pi end or something else?
Oh and one more thing I wanted to ask - Is it possible to update the firmware of the STM via the raspberry pi Over-The-Air or is it a vague target?
Thanks
Siddharth
2019-04-08 05:48 AM
What kind of AIR are you using here? Which STM32 specifically are you talking about, perhaps a few hundred parts.
The ST-LINK uses SWD/JTAG, you provide these to the RPi in the design? The debugger downloads code to RAM to control things and write Flash. At least several orders more magnitude more complicated to use JTAG/SWD vs USART, etc.
>>Are you referring to the STM end and Raspberry Pi end or something else?
How do you see yourself getting firmware updates to the RPi, and then delivered to the STM32. I think you're going to need someone here with some programmer experience that can code things rather than copy stuff and need it all explained.
Did you write the code on the STM32? Did you design the board it is on? What modes of connectivity does it provide?
Understand the available loader explained in the two cited App Notes.
Decide if those describe something you can work with, or if you need to code something different.
2019-04-08 06:22 AM
By air I meant we will send the code as a file to the raspberry pi over the internet, but for now, we will be pushing the code to a pi over the local network for testing. We are using STM32F303CCT6.
No, we aren't using ST Link in the design. Until now we used to burn the code manually on the STM board using the ST-Link.
Don't worry about how the code will be sent to the Pi. That will all be taken care of by the people who work on cloud here. Just suppose the firmware file to be burnt onto the STM32 board is already present on the Pi.
I just need a way to transfer this code from the Pi to the STM board.
Yes, I have written code on the STM32.
Yes, our team here has designed the board it is on but we are still in the designing phase and want to give the product this capability to update the STM from the Pi.
It can communicate using UART, SPI and I2C.
Currently our design is on STM32F303CCT6. There is no constraint on the number of pins this process can use, if this uses an SPI port, we will remove the other thing already consuming it as giving the product this capability is a priority. I just need to find a way to dump the code from the Pi (which ports on the Pi shoud I use?) onto the STM32 board, preferably STM32F303CCT6.
We are still in the designing process so if you will suggest some other STM microcontrollers that have the capability to be updated as per the requirement, that would be really appreciated.
Thanks,
Siddharth Soni
2019-04-08 06:53 AM
> It can communicate using UART, SPI and I2C.
None of these are "over air". So is a wired connection OK, or you want something wireless?
-- pa
2019-04-08 08:44 AM
AN2606 should constrain the specific pins you'd want to focus on, and the interfaces.
Likely want control of the NRST, BOOT0 and USART1 PA9/PA10 or USART2 PA2/PA3
You can use quite high baud rates. The protocol isn't super complicated.
I'd probably use my own small loader, and implement something using XMODEM, as it is a standard algorithm, and doesn't require custom apps. I see the ROM loader as a recovery mode for a totally bricked device. Usually you want to present something more polished to your end users.
AN3155 describes the protocol
I implemented my own command line tool for this, pretty sure some open sources ones available if you look at little.
If you have USB DFU might be an option, look at what RPi/Linux resources there are.
2019-04-09 03:31 AM
Pi will access the internet wirelessly and is connected to the STM board with wires. The Pi is basically needed to burn a code that it gets from the cloud onto the STM board to update the code running on it. What should be the procedure for doing so? Which protocols should be used? Which families of STM support this kind of updation?
Thanks
Siddharth Soni