This chapter is very important. The recommended waveform refresh methods have been verified through a large number of tests.
5.1 Waveform fast refresh solution
5.2 Quick refresh of oscilloscope background
5.3 When the system is powered on, the main interface does not flicker
5.4 Refreshing the Measurement Window
5.5 How to refresh the interface when opening or closing dialog boxes
5.6 Fast refresh of five numerical display windows
5.7 Summary
5.1 Waveform fast refresh solution selection
There are many solutions to test for fast waveform refresh. Since our GUI uses emWin, the following tests are all implemented based on emWin.
(1) Select 8-bit color or 16-bit color.
(2) Enable triple buffering or window storage device.
(3) Choose the emWin library in ARGB format or the library in ABGR format.
(4) Is there any improvement after overclocking the STM32F429 and refreshing it?
(5) Use the memory device function GUI_MEMDEV_Draw or the multi-buffer functions GUI_MULTIBUF_Begin() and GUI_MULTIBUF_End().
(6) Use the function GUI_DrawGraph or GUI_DrawPolyLine to draw the waveform.
The following are some explanations of these plans.
5.1.1 Choose 8-bit or 16-bit color
In the previous test of emWin brushing color blocks, 8-bit color can run more than 200 million points per second, while 16-bit color can run more than 100 million points per second. In actual tests, it is found that 8-bit color is OK for brushing color blocks, but it is not OK for brushing waveforms, which is quite laggy, so 16-bit color is used.
Some readers may ask why we don’t use 32-bit color? For a single-chip microcomputer, it is more difficult to use 32-bit color than 16-bit color. So 32-bit color is not considered.
Knowledge point expansion
New version of emWin tutorial Chapter 34: Color formats supported by STemWin: http://forum.armfly.com/forum.php?mod=viewthread&tid=19834.
5.1.2 Triple Buffering or Window Storage Devices
For STM32F429, enabling triple buffering means that the user needs to configure multi-buffering in the LCDConf_Lin_Template.c file and call the WM_MULTIBUF_Enable(1) function in the application to enable it.
Using memory devices is achieved by calling the function WM_SetCreateFlags (WM_CF_MEMDEV).
If the emWin configuration supports multiple buffers and window storage devices, multiple buffers must be used first. In actual testing using the STM32F429BIT6 + 32-bit SDRAM + RGB565/RGB888 platform, multiple buffers can effectively reduce the tearing sensation when the window moves or slides, and effectively improve the fluency, which cannot be achieved by enabling the window to use memory devices. Therefore, our oscilloscope also chooses to use triple buffers. The way to enable multiple buffers is as follows:
/*
*********************************************************************************************************
* Function name: MainTask
* Function description: GUI main function
* Parameters: None
* Return value: None
*********************************************************************************************************
*/
void MainTask(void)
{
/* emWin initialization */
GUI_Init();
/* Enable multi-buffering */
WM_MULTIBUF_Enable(1);
/* Omitted */
}
5.1.3 Use the ARGB format emWin library or the ABGR format library
Since we have chosen to use the RGB565 color format, for this color format, using the ARGB format emWin library does not improve performance, and additional matters need to be paid attention to when actually writing application code. So continue to use the ABGR format library.
Knowledge point expansion
Special Tutorial No. 1: Implementing emWin's fast refresh solution based on STM32's hardware RGB888 interface, 32-bit color or 24-bit color: http://forum.armfly.com/forum.php?mod=viewthread&tid=44512.
5.1.4 Is there any improvement after overclocking STM32F429 and refreshing it?
The built-in Flash of STM32F429 cannot achieve zero delay. As the main frequency is set higher, the delay parameter needs to be set larger.
The test results given in the parameter manual are as follows:
In actual tests, overclocking to 216MHz did not improve performance, so for stability, 168MHz was still used. As for why the 180MHz supported by F429 was not used, the reason is described in this post: http://forum.armfly.com/forum.php?mod=viewthread&tid=16830 .
5.1.5 Use storage device function or triple buffer function for overall refresh
The previous generation of oscilloscopes were plotted in the following way:
GUI_MEMDEV_Draw(&Rect, _Draw, &Param, 0, GUI_MEMDEV_NOTRANS);
The waveform display area and waveform drawing are implemented in the function _Draw, but the speed is relatively slow. The refresh rate of the 600*480 display area is about 10 frames. Obviously, this method can no longer be used for the second-generation oscilloscope. The speed is too slow. In addition, actual tests have found that the F429 uses this method a little slower than the F407 in the first-generation oscilloscope. This result is obviously not what we want. The current drawing method uses a multi-buffer function:
GUI_MULTIBUF_Begin();
/* Implement waveform drawing between these two functions*/
GUI_MULTIBUF_End();
Using these two functions for overall refresh can effectively avoid flickering and tearing when the waveform is refreshed.
5.1.6 Which function is used to draw the waveform?
The previous generation of oscilloscopes used the function GUI_DrawPolyLine to draw waveforms. When this function was also used in the second generation oscilloscope, it was found that the speed was much slower, but this problem did not exist when the function GUI_DrawGraph was used. Moreover, after re-optimizing the underlying layer, the performance of the function GUI_DrawPolyLine did not improve. It is estimated that there is a problem with the internal execution mechanism. The advantage of using the function GUI_DrawPolyLine is that it can achieve various waveform effects. In view of the poor performance of this function, GUI_DrawGraph is still used.
5.1.7 Use single or dual layers
Since the hardware dual-layer performance of STM32F429 is limited and it is more troublesome to manage using emWin, the second-generation oscilloscope uses a single layer to implement it.
5.2 Quick refresh of oscilloscope background
The oscilloscope interface display effect is as follows:
The background of the waveform display area is fixed, so it is drawn into the storage device after power-on. In the future, the display background can directly call the API function of the storage device. The following is the drawing of the oscilloscope background:
/*
*********************************************************************************************************
* Function name: CreateWindowAmplitude
* Function description: Create an amplitude window
* Parameter: x0 upper left corner x coordinate
* y0 upper left corner y coordinate
* x1 x coordinate of the lower right corner
* y1 lower right corner y coordinate
* Return value: None
*********************************************************************************************************
*/
void DSO_DrawBakFrame(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
{
uint16_t x;
uint16_t y;
/* Fill background */
GUI_SetBkColor(GUI_BLACK);
GUI_ClearRect(x0, y0, x1, y1);
GUI_SetColor(GUI_WHITE);
/* Draw horizontal scale points */
for (y = 0; y < 9; y++)
{
for (x = 0; x < 61; x++)
{
GUI_DrawPoint(x0 + (x * 10), y0 + (y * 50));
}
}
for (x = 0; x < 61; x++)
{
GUI_DrawPoint(x0 + (x * 10), y1);
}
/* Draw vertical scale points */
for (x = 0; x < 12; x++)
{
for (y = 0; y < 41; y++)
{
GUI_DrawPoint(x0 + (x * 50), y0 + (y * 10));
}
}
for (y = 0; y < 41; y++)
{
GUI_DrawPixel(x1, y0 + (y * 10));
}
/* Draw the point on the last foot*/
GUI_DrawPixel(x1 - 1, y1 - 1);
/* Draw the vertical center scale point*/
for (y = 0; y < 41; y++)
{
GUI_DrawPixel(x0 - 1 + (300), y0 + (y * 10));
GUI_DrawPixel(x0 + 1 + (300), y0 + (y * 10));
}
GUI_DrawPixel(x0 - 1 + (300), y1);
GUI_DrawPixel(x0 + 1 + (300), y1);
/* Draw the horizontal center scale point*/
for (x = 0; x < 61; x++)
{
GUI_DrawPixel(x0 + (x * 10), y0 - 1 + (200));
GUI_DrawPixel(x0 + (x * 10), y0 + 1 + (200));
}
GUI_DrawPixel(x1, y0 - 1 + (200));
GUI_DrawPixel(x1, y0 + 1 + (200));
}
Draw the oscilloscope background to the storage device in the following way:
hMemDSO = GUI_MEMDEV_CreateFixed(0,
0,
600,
400,
GUI_MEMDEV_HASTRANS,
GUI_MEMDEV_APILIST_16,
GUICC_M565);
/* Draw the oscilloscope window background*/
GUI_MEMDEV_Select(hMemDSO);
DSO_DrawBakFrame(0,0,599,399);
GUI_MEMDEV_Select(0);
To draw the oscilloscope background in the program in the future, you only need to call the following function
GUI_MEMDEV_WriteAt(hMemDSO, 40, 40);
The actual test of this function only takes 9-10ms to complete.
5.3 When the system is powered on, the main interface does not flicker
In order to pursue the ultimate user experience, two problems that exist after the board is turned on need to be solved.
1. Overall loading of the interface
Sometimes the interface design is more complicated, and it cannot be guaranteed that all controls are loaded at the same time after booting. At this time, there is a very simple solution: hide the desktop window before drawing and show the desktop window after drawing is completed.
WM_HideWin(WM_HBKWIN);
/* Initialize DSO */
DSO_Init(1);
WM_ShowWin(WM_HBKWIN);
2. Highlight generated at the moment of power-on
Previous article:Oscilloscope selection parameters
Next article:How to use the oscilloscope trigger
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Understand the important role and characteristics of inductors
- [Qinheng Trial] Three CH549 uses pwm to adjust the brightness of the lamp
- Gallium nitride killer application: lithium battery protection!
- About C language conditional compilation
- 【National Technology N32G430】LCD-ST7735
- The STM32 video account and B station account have been opened. Are you paying attention?
- 【RT-Thread Reading Notes】Reflections on RT-Thread Chapter 9
- 100% gift for a limited time: Download and share Keysight millimeter wave radar data to win a gift
- About GUI_Init stuck when emwin is ported to stm32f2
- Huawei Static Timing Analysis and Logic Design.pdf