✍ How to write (change) variable value in STM32CubeMonitor?
STM32CubeMonitor is powerful and extremely useful software for debugging STM32 microcontrollers. Thanks' to this article you will find out how to plot your variable like a chart, which represents the default example of the program.
⏩ Quick import nodes
1) Open STM32CubeMonitor and Import code (Ctrl + I):
2) Now just copy the example code below, paste it and press Import:
3) Press Import copy:
4) Now you can see new Flow 1, so just delete the first one (default):
5) Now that's all, but we need to make some configuration for your specific STM32CubeIDE project. ⬇
1) Because you've insert my JSON code, you should change executable file to the your project, so open myVariables node:
2) Now you can see the mine Executable file (from Buzzer library project), press on the pencil to change another (your):
3) You can find this file (.elf) in the Debug folder of the project directory, copy path to this folder and insert in Folder field, File will load automaticly:
4) Find the variable, that you need to monitor (the variable should be global, not local) and press Update:
5) Now you can see full list of the chosen variables, including the actual address in the RAM and type:
➡ TIP: You can manually add any microcontroller's register by using address from the Reference Manual and later we will test that
↪ How to write variable?
1) Find Write Panel in the list STMicroelectronics:
2) Place and connect Write Panelto the myVariables and Probe_Out:
3) There are no important setting in this node:
4) Press DEPLOY and then DASHBOARD:
5) Press START ACQUISTION:
6) Enter any appropriate data (of course in the range of the variable type) and press WRITE:
That's all, now you can easily change the value in the variable (RAM memory area) directly with STM32CubeMonitor, which much more convenient for the advanced debug .
In previously showed example I changed the value of the variable, that changed buzzer frequency:
That could be used for configuration, when you evaluate the tone of the sound.
Above I monitor it also with logic analyzer, but also in could be done with oscilloscope:
With using HS402 oscilloscope:
STM32CubeMonitor looks really good, but not simple as it seems, and could be extremely useful.
The basic configuration shows how to plot variable on chart, so this article help you to write variable.
The next articles will cover similar but more deep debugging:
- How to write in the register directly?
- How to read from register directly?