Skip to main content
Associate II
August 23, 2024
Question

How can I change values in real time while code is running on STM32CubeIDE

  • August 23, 2024
  • 1 reply
  • 1023 views

Hello, I am using STM32F407G MCU and STM32CubeIDE Software.

 

I'm trying to tune a PI controller for my device and controller is embedded in the STM32 microcontroller. After writing the code and setting the parameters, I've been uploading it to the device. However, it's a lengthy process to stop the code, change Kp, Ki values, rebuild, and debug each time.

Is there a faster way to modify the Kp and Ki gains without constantly stopping and restarting the code? I've tried using Live Expressions, but it doesn't seem to work in STM32CubeIDE.

1 reply

Muhammed Güler
Senior III
August 23, 2024

If you make the PID parameters variable, you can use the communication you want and change the parameters. You can transfer the KP, KD and KI values ​​to the MCU with the protocol you will create and ensure that the PID algorithm starts over with the new values. It requires some programming work.