1542 views|1 replies

6

Posts

2

Resources
The OP
 

[Design of online monitoring system] TouchGFX touch point based on STM32H7B3-DK... [Copy link]

 


TouchGFX touch-controlled LED lighting

project link based on STM32H7B3-DK:

链接已隐藏,如需查看请登录或者注册

Extraction code: myi1
1 Use TouchGFX Designer to generate MDK5 project

Development environment

TouchGFX software version: 4.20.0

MDK5 software version: 5.37.0

STM32CubeMX software version: 6.6.1

Development board: STM32H7B3-DK

Desktop system: Window10



1.1 Generate Keil project template

For fast GUI development, use TouchGFX to generate MDK5 project template based on STM32H7B3-DK

Open TouchGFX, click Create New Project



Automatically jump to the development board selection interface, follow steps 1-5 to create a new project, be careful not to have Chinese paths, otherwise some unexpected errors will occur.



The TouchGFX generated project structure is as follows, (subsequently delete EWARM, gcc, STM32CubeIDE and other folders not related to Keil)



There is a STM32CubeMX project file in the generated folder. Since the default configuration generates STM32CubeIDE project code, we need Keil project code, so we need to switch IDE (except this point, do not change any configuration)



Double-click the .ioc file, if the following prompt appears, click Migrate



Click Project Management, select MDK-ARM as IDE, and then click Generate Code



At this point, the Keil project template is basically established, but if you open the Keil project directly and compile (select V5 compiler here, because V6 compiler will have
many errors), the following problem will occur. This is because TouchGFX did not generate code, resulting in a lack of interface-related source code



Just go back to TouchGFX and click Generate Code



At this point, the Keil interface will pop up a project change message, click Yes



Compile the Keil project again, no error, if there is a warning, it will disappear after compiling again, and generate a .hex file

[ attach]632294[/attach]
Open STM32CubeProgrammer, connect the development board, click EL, select the external flash burning algorithm



After that, click download, select the .hex file, and burn



When the development board is already running, burn the program. If the following error occurs, disconnect the device and reconnect it again before burning. A white screen before burning indicates normal




Use Since a blank template is generated, a black screen will appear after downloading to the development board. At this time, return to TouchGFX, drag a control to the interface at random, and generate code



After that, compile it in keil and download it again to display normally



2 Use external burning script (stdlr) to burn QSPI in keil environment.

In GUI design, large storage space is required. At this time, we need to put the code and data in the external QSPI storage space and use the debugging
tool as much as possible. One-key burning tool

Software: keil5, STM32CubeProgrammerv2.10.0


Burning method

In Keil debugging environment, there are two ways to burn external QSPI storage space. One is based on FLM algorithm, which is provided in keil.BSP package.
The second method is to call a third-party script for burning. Here, the corresponding .stdlr script provided by ST's STM32CubeProgrammer is used.


Set environment variables

1. Open the environment variable setting steps



2. Add environment variables to the installation directory where STM32_Programmer_CLI.exe is located. The default directory is as follows:



3 Verify whether the environment variable is added successfully. Open the CMD command prompt and enter "STM32_Programmer_CLI -version". If the following is displayed, the setting is successful.




Keil download settings

In Keil, we use the third-party tool download method to download. The steps are as follows

1. Configure the download tool as shown in the figure below. The command and parameters filled in the last step are as follows:



The .\STM32H7B3I-DK\STM32H7B3I-DK.hex in the command is the Hex file generated by the project and needs to be modified according to the project.
The target of the burning script stldr also needs to be modified accordingly. STM_Programmmer_CLI.exe will
decide which address to burn the code to based on the address information in STM32H7B3I-DK.hex, so before compiling, it is necessary to specify in the scatter loading file (*.sct) that the code is placed in the address range of the external QSPI Flash.



2 Download results

After downloading, press the reset button once to display normally



3 TouchGFX touch control lights up the LED

TouchGFX uses the MVP architecture to separate the UI interface, interface logic, and hardware system.

View: Responsible for describing the UI interface, such as which controls are included and how the controls are laid out. The work in the Touchgfx Designer software is to build the View
Model: Save data related to the UI interface; there is a tick() function that executes 60 times per second to interact with the hardware system, which is equivalent to a bridge between the hardware and Touchgfx.
Presenter: Acts as a microphone between the Model and the View
System: All other parts except Touchgfx belong to the category of System

[attach]632306 [/attach]
We can also directly call the HAL_GPIO_TogglePin function in the click event callback function of View, but this will destroy the MVP structure and is not recommended.
So let's follow the official method and peel off the nesting dolls layer by layer. The reason for using the MVP architecture is to separate the code functions and enhance the portability and readability of the system.


1. Configure LED3 through STM32CUBMX

2. Put a button in Touchgfx Designer and add an interactive function btnClicked to it:

[attach]632307 [/attach]

3 Open keil, and then implement btnClicked in Screen1View:

[attach]632308 [/attach]

[attach]632309 [/attach]

4 Since there is no btnClicked method in presenter, you need to add one for it:

[attach]632310 [/attach]





5. Similarly, there is no toggleLED method in Model, so it still needs to be added.





6 If there is no error in the compilation, it can be downloaded to the development board.

Additional explanation of
the compilation error problem under the V6 compiler








ruP9OegjIYAAAAABJRU5ErkJggg== (14.79 KB, downloads: 0)

ruP9OegjIYAAAAABJRU5ErkJggg==

2020041011584894.png (28.77 KB, downloads: 0)

2020041011584894.png

ei7NDnEAAAAASUVORK5CYII= (39.84 KB, downloads: 0)

ei7NDnEAAAAASUVORK5CYII=

OwnoAAAAASUVORK5CYII= (51.04 KB, downloads: 0)

OwnoAAAAASUVORK5CYII=

D3khR5bOnQPzAAAAAElFTkSuQmCC (50.49 KB, downloads: 0)

D3khR5bOnQPzAAAAAElFTkSuQmCC

u3LwZ4uA048AAAAASUVORK5CYII= (62.64 KB, downloads: 0)

u3LwZ4uA048AAAAASUVORK5CYII=
This post is from DigiKey Technology Zone

Latest reply

The author introduces the method of burning QSPI using an external burning script (stdlr) in the Keil environment. It is good.   Details Published on 2022-8-17 07:28
 
 

6587

Posts

0

Resources
2
 

The author introduces the method of burning QSPI using an external burning script (stdlr) in the Keil environment. It is good.

This post is from DigiKey Technology Zone
 
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>
Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list