搜档网
当前位置:搜档网 › STM32CubeF4 demonstration platform

STM32CubeF4 demonstration platform

April 2014DocID026161 Rev 11/69

UM1743User manual

STM32CubeF4 demonstration platform

Introduction

The STM32Cube TM initiative was originated by STMicroelectronics to ease developers’ life by reducing development efforts, time and cost. STM32Cube TM covers the STM32 portfolio.The STM32CubeF4 demonstration platform comes on top of the STM32Cube TM as a firmware package that offers a full set of software components based on a modules

architecture allowing re-using them separately in standalone applications. All these modules are managed by the STM32CubeF4 demonstration kernel allowing to dynamically add new modules and access to common resources (storage, graphical components and widgets, memory management, Real-Time operating system)

The STM32CubeF4 demonstration platform is built around the powerful graphical library STemWin and the FreeRTOS real time operating system and uses almost the whole STM32 capability to offer a large scope of usage based on the STM32Cube HAL BSP and several middleware components.

The architecture was defined with the goal of making from the STM32CubeF4

demonstration core an independent central component which can be used with several RTOS and third party firmware libraries through several abstraction layers inserted between the STM32CubeF4 demonstration core and the several modules and libraries working

around.

https://www.sodocs.net/doc/676529655.html,

Contents UM1743

Contents

1STM32Cube? overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2Global architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3Kernel description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.1Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.2Kernel Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.3Kernel processes and tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.4Kernel graphical aspect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11

3.5Kernel menu management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.6Modules manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.7Direct open feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3.8Backup and settings configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3.9Storage units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.10Clock and Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.11Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3.12Demonstration repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

3.13Kernel components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.14Kernel core files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.15Hardware settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

4How to create a new module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

4.1Creating the graphical aspect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

4.2Graphics customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

4.3Module implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

4.4Adding a module to the main desktop . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

4.5Module's direct open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

5Demonstration customization and configuration . . . . . . . . . . . . . . . . 31

5.1LCD configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

5.2Layers management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

5.3Touchscreen calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 2/69DocID026161 Rev 1

UM1743Contents

5.4BSP customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.4.1SDRAM configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.4.2Touch screen configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

6Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

6.1Multi buffering features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

6.2Multi layers feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

6.3Hardware acceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

7Footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

7.1Kernel footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

7.2Module footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

7.3STemWin Features resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

7.3.1JPEG decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

7.3.2GUI Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

8Demonstration functional description . . . . . . . . . . . . . . . . . . . . . . . . . 43

8.1Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

8.1.1CPU Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

8.1.2Kernel Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

8.1.3Process Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

8.2Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

8.2.1System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

8.2.2File Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

8.2.3Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

8.2.4Benchmark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

8.2.5Audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

8.2.6Video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

8.2.7USB Mass storage Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

8.2.8Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

8.2.9Image viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 9Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

DocID026161 Rev 13/69

List of tables UM1743 List of tables

Table 1.File system interface: physical storage control functions . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Table 2.File system interface APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Table 3.APIs from the RTC module. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Table 4.APIs from the memory manager module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Table 5.Kernel components list. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Table 6.Kernel core files list. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Table 7.Jumpers for different demonstration boards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Table 8.LCD frame buffer locations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Table 9.Camera frame buffer locations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Table 10.Kernel files footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Table 11.Modules footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Table 12.RAM requirements for some JPEG resolutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Table 13.MemoSTemWin components memory requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Table 14.Widget memory requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Table 15.Available settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Table 16.Data structure for audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Table 17.Audio module controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Table 18.Video module controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Table 19.Batch files description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Table 20.Variables description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Table 21.Parameters description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Table 22.Data structure for USBD module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Table https://www.sodocs.net/doc/676529655.html,BD module controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Table 24.Camera module controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Table 25.Image viewer module controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Table 26.Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 4/69DocID026161 Rev 1

UM1743List of figures List of figures

Figure 1.STM32Cube block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Figure 2.STM32Cube architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Figure 3.Kernel components and services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Figure 4.Startup window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Figure 5.Main desktop window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Figure 6.Status bar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Figure 7.Icon view widget. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Figure 8.Functionalities and properties of modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Figure 9.Starting file execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Figure 10.Available storage units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Figure 11.Software architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Figure 12.Detection of storage units. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Figure 13.Setting the time and date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Figure 14.Memory heap for STM32CubeF4 demonstration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Figure 15.Folder structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Figure 16.STM32Cube demonstration boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Figure 17.GUI Builder overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Figure 18.Graphics customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Figure 19.Direct open from file browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Figure 20.LCDConf location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Figure 21.k_calibration.c location. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Figure 22.Calibration steps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Figure 23.SDRAM initialization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Figure 24.Touch screen initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Figure 25.Example of tearing effect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Figure 26.Independent layer management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Figure 27.CPU usage display. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Figure 28.CPU usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Figure 29.Example of Log messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Figure 30.Process viewer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Figure 31.Demonstration global information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Figure 32.Demonstration general settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Figure 33.Clock setting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Figure 34.File browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Figure 35.File browser module architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Figure 36.File opening from browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Figure 37.File properties display. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Figure 38.Reversi game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Figure 39.Benchmarking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Figure 40.Audio player module architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Figure 41.Audio player module startup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Figure 42.Video player module architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Figure 43.Video player module startup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Figure 44.EMF generation environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Figure 45.JPEG2Movie overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Figure 46.EMF file generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Figure https://www.sodocs.net/doc/676529655.html,BD module architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Figure https://www.sodocs.net/doc/676529655.html,BD module startup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

DocID026161 Rev 15/69

List of figures UM1743 Figure 49.Camera module architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Figure 50.Camera module startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Figure 51.Image viewer architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Figure 52.Image viewer startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

6/69DocID026161 Rev 1

DocID026161 Rev 17/69

UM1743STM32Cube? overview

1 STM32Cube ? overview

The STM32Cube TM initiative was originated by STMicroelectronics to ease developers’ life by reducing development efforts, time and cost. STM32Cube TM covers the STM32 portfolio.STM32Cube TM Version 1.x includes:?The STM32CubeMX, a graphical software configuration tool that allows to generate C initialization code using graphical wizards.

?

A comprehensive embedded software platform, delivered per series (such as

STM32CubeF4 for STM32F4 series)–The STM32CubeF4 HAL, an STM32 abstraction layer embedded software, ensuring maximized portability across STM32 portfolio

– A consistent set of middleware components such as RTOS, USB, TCP/IP , Graphics

All embedded software utilities coming with a full set of examples.

Figure 1. STM32Cube block diagram

Global architecture UM1743

8/69DocID026161 Rev 1

2 Global architecture

The STM32CubeF4 demonstration is composed of a central kernel based on a set of

firmware and hardware services offered by the STM32Cube middleware and the several evaluation and discovery boards and a set of modules mounted on the kernel and built in a modular architecture. Each module can be reused separately in a standalone application. The full set of modules is managed by the Kernel which provides access to all common resources and facilitates the addition of new modules as shown in Figure 2.Each module should provide the following functionalities and proprieties:1. Icon and graphical aspect characteristics.2. Method to startup the module.

3. Method to close down safety the module (example: Hot unplug for Unit Storage)

4. Method to manage low power mode

5.

The module application core ( main module process)

6. Specific

configuration 7. Error management

Figure 2. STM32Cube architecture

DocID026161 Rev 19/69

UM1743Kernel description

3 Kernel description

3.1 Overview

The role of the demonstration kernel is mainly to provide a generic platform that control and

monitor all the application processes, the kernel provides a set of friendly user APIs and services that allow to the user modules to have access to all the hardware and firmware resources and provide the following tasks and services:?

Hardware and modules initialization:–BSP initialization (LEDs, SDRAM, Touch screen, CRC, SRAM, RTC and audio –GUI initialization and Touch screen calibration

?Memory management ?Kernel log

?Graphical resources and main menu management.

?Storage managements (USB Disk flash and microSD)?System monitoring and settings ?Time and date resources management ?File browsing and contextual menu ?

CPU utilities (CPU usage, running tasks)

Figure 3. Kernel components and services

Kernel description UM1743

10/69DocID026161 Rev 1

3.2 Kernel Initialization

The first task of the kernel is to initialize the hardware and firmware resources to make them

available to its internal processes and the modules around it. The kernel starts by initializing the HAL, system clocks and then the hardware resources needed during the middleware components:?LEDs and Touchscreen ?SDRAM/SRAM ?Backup SRAM ?RTC

?

Audio Interface

Once the low level resources are initialized, the kernel performs the STemWin GUI library initialization and prepares the following common services:?Memory manager ?Storage units ?Modules manager ?

Kernel Log

Upon full initialization phase, the kernel adds and links the system and user modules to the demonstration core.

3.3 Kernel processes and tasks

The kernel is composed of three main task managed by FreeRTOS through the CMSIS-OS wrapping layer:?

Start Thread: this is the main kernel task, it has a normal priority and manages the modules and some delayed common services including the startup window;?

GUI Thread: this task Initializes the demonstration main menu and then handles the graphical background task when requested by the STemWin;

DocID026161 Rev 111/69

UM1743

Kernel description

?

Timer Callback: this is the callback of the Timer managing periodically the touch screen state, the Timer callback is called periodically each 40 milliseconds.

3.4 Kernel graphical aspect

The STM32CubeF4 demonstration is built around the STemWin Graphical Library, based on

SEGGER emWin one. STemWin is a professional graphical stack library, enabling Graphical User Interfaces (GUI) building up with any STM32, any LCD and any LCD controller, taking benefit from STM32 hardware accelerations, whenever possible.

The graphical aspect of the STM32CubeF4 demonstration is divided into two main graphical components:

?the startup window (Figure 4): showing the progress of the hardware and software

initialization;

?

the main desktop (shown in Figure 5), that handles the main demonstration menu and the numerous kernel and modules control.

Figure 4. Startup window

Kernel description

UM1743

12/69DocID026161 Rev 1

Figure 5. Main desktop window

3.5 Kernel menu management

The main demonstration menu is initialized and launched by the GUI thread. Before the

initialization of the menu the following actions are performed:?Draw the background image.?Create the status bar.

?Restore general settings from backup memory.

?Setup the main desktop callback to manage main window messages.

The main desktop is built around two main graphical components:

?

The status bar (Figure 6): indicates the storage units connection status, current time and date and a system button to allow to get system information like (running task, CPU load, and kernel log).

?

The icon view widget (Figure 7): contains the icons associated to added modules. User can launch a module by a simple click on the module icon.

06 9

DocID026161 Rev 113/69

UM1743

Kernel description

Figure 6. Status bar

Figure 7. Icon view widget

06 9

06 9

Kernel description UM1743

14/69DocID026161 Rev 1

A module is launched on simple click on the associated icon by calling to the startup function in the module structure; this is done when a WM_NOTIFICATION_RELEASED message arrives to the desktop callback with ID_ICONVIEW_MENU:

3.6 Modules manager

The modules are managed by the kernel; the latter is responsible of initializing the modules,

initializing hardware and GUI resources relative to the modules and initializing the common resources such as the storage Unit, the graphical widgets and the system menu.Each module should provide the following functionalities and proprieties:1.Icon and graphical component structure.2. Method to startup the module.

3. Method to close down safety the module (example: Hot unplug for MS flash disk)

4. Method to manage low power mode (optional)

5. The Application task

6.

The module background process (optional)

DocID026161 Rev 115/69

UM1743

Kernel description

7.

Remote control method (optional)

8. Specific configuration

9. Error management

Figure 8. Functionalities and properties of modules

The modules could be added in run time to the demonstration and can use the common

kernel resources. The following code shows how to add a module to the demonstration:

A module is a set of function and data structures that are defined in a data structure that provides all the information and pointers to specific methods and functions to the kernel.

This later checks the integrity and the validity of the module and inserts its structure into a module table.

Each module is identified by a unique ID. When two modules have the same UID, the Kernel rejects the second one. The module structure is defined as follows:

Kernel description

UM1743

16/69DocID026161 Rev 1

In this definition:?Id: unique module identifier.?Name: pointer to module name

?Icon: pointer to module icon (bitmap format)

?Startup: the function that create the module frame and control buttons ?

DirectOpen: the function that create the module frame and launch the media associated to the file name selected in the file browser linked to a specific file extension.

3.7 Direct open feature

The direct open feature allows launching a media module directly from file browser when the extension file match with supported media type. The file extension should be previously associated to a module by using the following code:

When the file browser is opened, a simple click on a file will open a contextual menu, that direct file open can be executed, as shown in Figure 9:

Figure 9. Starting file execution

3.8 Backup and settings configuration

The STM32CubeF4 demonstration saves the kernel and modules settings in two different

methods:1.

Using the RTC backup register (32 bits data width) , in this method the data to be saved should be a 32 bits data and could be defined as a bitfield structure, example:

06 9

DocID026161 Rev 117/69

UM1743Kernel description

The structure could be handled than, by using the two following kernel APIs to save or restore it from the RTC backup registers.

2.

Using the backup SRAM: the backup SRAM is a memory that the content is not lost when the board is powered down. When available, the backup SRAM is 4 Kbytes size and located at address: BKPSRAM_BASE (0x40024000). The backup SRAM could be used as normal RAM to save file paths or big structure example:

Kernel description UM1743

18/69DocID026161 Rev 1

3.9 Storage units

The STM32CubeF4 demonstration kernel offers two storage units that can be used to

retrieve audio, Image and Video media or to save captured images from the camera (Figure 10).

The two units are initialized during the platform startup and thus they are available to all the modules during the STM32CubeF4 demonstration run time. These two units are accessible through the standard I/O operations offered by the FatFS used in the development platform. The USB Disk flash unit is identified as the Unit 0 and available only if a USB disk flash is connected on the USB FS connector, while the microSD flash is identified as the Unit1 and available only if the microSD card is connected. The units are mounted automatically when the physical media are connected to the connector on the board.

The implemented functions in the file system interface to deal with the physical storage units are summarized in Table 1.

Table 1. File system interface: physical storage control functions

Function

Description

disk_initialize Initialize disk drive

disk_read Interface function for a logical page read disk_write Interface function for a logical page write disk_status Interface function for testing if unit is ready disk_ioct

Control device dependent features

UM1743Kernel description The full APIs functions set given by the file system interface are listed in Table 2:

Table 2. File system interface APIs

Function Description

f_mount Register/Unregister a work area

f_open Open/Create a file

f_close Close a file

f_read Read file

f_write Write file

f_lseek Move read/write pointer, Expand file size

f_truncate Truncate file size

f_sync Flush cached data

f_opendir Open a directory

f_readdir Read a directory item

f_getfree Get free clusters

f_stat Get file status

f_mkdir Create a directory

f_unlink Remove a file or directory

f_chmod Change attribute

f_utime Change timestamp

f_rename Rename/Move a file or directory

f_mkfs Create a file system on the drive

f_forward Forward file data to the stream directly

f_chdir Change current directory

f_chdrive Change current drive

f_getcwd Retrieve the current directory

f_gets Read a string

f_putc Write a character

f_puts Write a string

f_printf Write a formatted string

For the FAT FS file system, the page size is fixed to 512 bytes. USB disk flashes with higher

page size are not supported.

DocID026161 Rev 119/69

Kernel description UM1743

20/69DocID026161 Rev 1

The Storage units are built around the USB host library in high speed and the microSD BSP

drivers; the software architecture is shown in Figure 11.

Figure 11. Software architecture

The FatFS is mounted upon the USB Host mass storage class and the SD BSP driver to allow an abstract access to the physical media through standard I/O methods.

相关主题