STM32-LTDC, LCD-TFT, LVGL(MCU3) Lecture 63| Testing RGB mixer application on STM32F429 DISC board

  • Post author:
  • Post category:Blog

 

Testing RGB mixer application on STM32F429 DISC board


 

In this article, let’s test the RGB_Mixer project on the STM32 Microcontroller Board. 

 

Exercise: RGB Mixer

Test on Hardware

  • Create a STM32 CubeIDE project
  • Add all required peripherals using IDE’s device configuration tool, LVGL and LVGL display, and touchscreen drivers.
  • Copy simulator tested code and test on the hardware.

 

Step 1: Setting up the IDE

Let’s get into the IDE. I have a project, LVGL_RGB_Mixer, and have already added the LVGL source. And hal_stm_lvgl is a driver for TFT and touchpad.

Figure 1.LVGL_RGB_Mixer project
Figure 1.LVGL_RGB_Mixer project

 

Step 2: Adding RGB Mixer Files

  • In your project, you need to include “rgb_mixer.c” and “rgb_mixer.h” files. Begin by opening “rgb_mixer.c.”
  • Navigate to the folder where these files are located, and drag and drop rgb_mixer.c into the ‘Src’ folder, selecting ‘Link to files.’
  • Similarly, add rgb_mixer.h to the ‘Inc’ folder using the ‘Link to files’ option.

 

Step 3: Integrating RGB Mixer Functionality

The “rgb_mixer.h” file provides the “rgb_mixer_create_ui” function. To use it, go to your “main.c” file.

Actually, rgb_mixer.h gives the rgb_mixer_create_ui function. So, we have to call this function from main.c.

Figure 2. rgb_mixer.h
Figure 2. rgb_mixer.h

 

In “main.c,” call the “rgb_mixer_create_ui()” function. Don’t forget to include the header file. For this, you have to add the header file of that. I added the rgb_mixer.h full path.  

Figure 3. rgb_mixer.h path
Figure 3. rgb_mixer.h path

 

Step 4: Compiling and Debugging

  • Compile your project. If successful, proceed to debug it.
  • Run your project.

Look at the output; actually, it is displayed in portrait mode. 

Figure 4. Output in Portrait mode
Figure 4. Output in Portrait mode

 

Step 5: Rotating the Display

Let’s use the LVGL API to rotate the user interface or rotate the screen. 

For that, you can make use of this function lv_disp_set_rotation. For this, you have to give the display, I mean the display object, which you can get from lv_disp_get_default, which returns the default display object, and after that, you have to set the rotation degree. Here, I have used a display rotates 270 degrees. 

Figure 5. Display rotation API
Figure 5. Display rotation API

 

Look at the output; there is some problem with the rotation.

Figure 6. Output
Figure 6. Output

 

To fix this issue, you must enable software rotation, which you can do in the tft_init. 

Go to the tft.c, and in the tft_init, add disp_drv.sw_rotate = 1;

disp_drv is a display driver object. It has a member element called software rotate. So, you have to turn it on. Because we are using a software rotate. I mean, the code rotates the display instead of sending commands to the display module. So, you have to make it 1.

Figure 7. tft.c file
Figure 7. tft.c file

 

Now you can see the Output. We are getting the proper display here. And verify that touch functionality works as expected. Ensure that sliders and controls respond correctly.

Figure 8. RGB_mixer Output
Figure 8. RGB_mixer Output

 

In the following article, let’s see how to test the same code on the F7 board and the F407 board interfaced with the external LCD. 

 

FastBit Embedded Brain Academy All courses

https://fastbitlab.com/course1

 

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.

Leave a Reply