Skip to main content
JKing.8
Associate II
July 21, 2022
Question

Creating an Executable with STM32CubeIDE

  • July 21, 2022
  • 3 replies
  • 1536 views

I am programming a microcontroller that will be in space flight. Currently to test the device we send the firmware to the board using something like the STM32CubeIDE or the stlink software. This works for now and allows us to run our code, but in flight, we can't use a cable and computer to upload the code and run it, we need the code to be on the board (in flash memory I assume), and we need to be able to execute it via UART commands from a computer on board the spacecraft. I am using an STM32F051R8. Any ideas?

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
July 21, 2022

It's not necessary to like your own posts..

You could use the ROM based system loader vai the serial port

See App Notes AN2606 and AN3155

https://www.st.com/resource/en/application_note/an3155-usart-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf

Implementation examples? Perhaps look at the GitHub for the Arduino MKR WAN 1300, which uses a Murata LoRa module with a STM32L0, ie same underlying protocol

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Andrew Neil
Super User
July 21, 2022

"in flight, we can't use a cable and computer to upload the code and run it, we need the code to be on the board (in flash memory I assume)"

So you load the software pre-flight - exactly as you are doing currently with CubeIDE & ST-Link.

Or are you talking about in-flight updates?

For in-flight updates, as @Community member​ says, you will need a bootloader

"we need to be able to execute it via UART commands from a computer on board the spacecraft"

Can this "computer" not just program the STM32?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
MM..1
Chief III
July 21, 2022

R8 inside have 64k flash. Then if i good understand you need no one code to run.

  1. You need know after reset start code "master"
  2. In master you can wait UART for command and do jobs

But this cant be changed in flight.

"in flight, we can't use a cable and computer to upload the code and run it, we need the code to be on the board (in flash memory I assume)"

This words cant be true. If you connect UART you use cable. And commands to UART is from high level computer.

UART give you way to reload full or partial flash memory.