STM Studio: Variables monitoring and visualization tool for STM32

STM Studio: Variables monitoring and visualization tool for STM32

In the previous tutorials, I have shown how to use the simple GPIO and external interrupt of the STM32. Since these peripherals are connected with external pins, we can visually observe how it works through some LEDs of the Discovery kit. Therefore, it is very easy to know whether our code is working correctly or not. However, when you are playing with some kinds of internal peripherals such as Timer/Counter, UART,… with types of data that are not bit anymore but byte or integer or float, you will need something else to diagnose that data. Typically, the programming environment like Keil or IAR provides us a debugging tool to debug those kinds of data in real-time but I found they are not so convenient and user-friendly at all. So, to prepare for our next tutorials, which will be more about internal peripherals, I am going to introduce you to the STM Studio from STMicroelectronics.

Install the STM Studio

The current version of the STM Studio from ST at the time of this post is 3.4. You can download it directly from ST website from this link: http://www.st.com/web/en/catalog/tools/PF251373

Or a mirror link here.


Monitoring and Visualization your data

To make it simple, I will use the code from the GPIO button tutorial to demonstrate how to config the STM Studio to connect and read variables from your STM32F0 kit in real-time. The program should be like this:

  • The User button will be used to increase a variable (‘long’ type) internally.
  • Connect the kit with STM Studio using onboard ST-Link
  • Show the variable in STM Studio in different types including graphs and tables.

You can watch the GPIO tutorial again and replace the code in the clip with the following code:

This part of the code in the clip:

/* USER CODE BEGIN 3 */
  /* Infinite loop */
  while (1)
  {
    if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0)){
        HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_9);
        HAL_Delay(100);
    }
    else
    {
        HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_RESET);
    }
  }
  /* USER CODE END 3 */

Need to be replaced with:

 /* USER CODE BEGIN 3 */
  /* Infinite loop */
  while (1)
  {
      if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0)){
        i++;
        HAL_Delay(200);
      }
  }
  /* USER CODE END 3 */

As you can see, we replace the LED toggle part with the increment calculation for variable ‘i’, which has been declared as ‘long’ type at the beginning of the program. Whenever we press the User button, this ‘i’ will be increased by 1 and we are gonna monitor this using STM Studio. Please watch and follow the clip below to know how to use the STM Studio to connect and read variables from your STM32F0 kit.

Next tutorial, I will show how to use the Timer peripheral of the STM32F0 as a timer to create a time base interrupt, generate PWM signal, and as a counter to count the input signal, encoder signal… Stay tuned!