dm00116575 Getting Started With Stm32cubef3 For stm32f3 Series Stmicroel PDF
dm00116575 Getting Started With Stm32cubef3 For stm32f3 Series Stmicroel PDF
User manual
Getting started with STM32CubeF3 for STM32F3 Series
Introduction
STMCube™ initiative is an STMicroelectronics original initiative to ease developers life by
reducing development efforts, time and cost. STM32Cube covers STM32 portfolio.
STM32Cube 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
STM32CubeF3 for STM32F3 Series)
– The STM32Cube HAL, an STM32 abstraction layer embedded software, ensuring
maximized portability across STM32 portfolio
– A consistent set of middleware components such as RTOS, USB, STMTouch, FatFS
and Graphics
– All embedded software utilities coming with a full set of examples
The STMCube™ package is a free solution that can be downloaded from ST website at
http://www.st.com/stm32cube.
This user manual describes how to get started with the STM32CubeF3 firmware package.
Section 1 describes the main features of STM32CubeF3 firmware, part of the STM32Cube
initiative.
Section 2 and Section 3 provide an overview of the STM32CubeF3 architecture and
firmware package structure.
Contents
5 FAQs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.1 What is the license scheme for the STM32CubeF3 firmware? . . . . . . . . 24
5.2 Which boards are supported by the STM32CubeF3 firmware package? . 24
5.3 Are any examples provided with the ready-to-use toolset projects? . . . . 24
5.4 Is there any link with Standard Peripheral Libraries? . . . . . . . . . . . . . . . . 24
5.5 Does the HAL take benefit from interrupts or DMA?
How can this be controlled? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.6 How are the product/peripheral specific features managed? . . . . . . . . . . 25
5.7 How can STM32CubeMX generate code based on embedded software? 25
5.8 How can the user get regular updates on the latest
STM32CubeF3 firmware releases? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.9 When to use HAL versus LL drivers? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.10 How can the user include LL drivers in his/her environment?
Is there any LL configuration file as for HAL? . . . . . . . . . . . . . . . . . . . . . 25
5.11 Can HAL and LL drivers be used together?
If yes, what are the constraints? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.12 Are there any LL APIs not available with HAL? . . . . . . . . . . . . . . . . . . . . 26
5.13 Why are SysTick interrupts not enabled on LL drivers? . . . . . . . . . . . . . . 26
5.14 How are LL initialization APIs enabled? . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
List of tables
List of figures
STM32CubeF3 gathers together, in a single package, all the generic embedded software
components required to develop an application on STM32F3 microcontrollers. In line with
the STM32Cube initiative, this set of components is highly portable, not only within
STM32F3 Series but also to other STM32 Series.
STM32CubeF3 is fully compatible with STM32CubeMX code generator that allows the user
to generate initialization code. The package includes a low level hardware abstraction layer
(HAL) that covers the microcontroller hardware, together with an extensive set of examples
running on STMicroelectronics boards. The HAL is available in open-source BSD license for
user convenience.
STM32CubeF3 package also contains a set of middleware components with the
corresponding examples. They come in very permissive license terms:
• Full USB Device stack supporting many classes: Audio, HID, MSC, CDC and DFU,
• CMSIS-RTOS implementation with FreeRTOS open source solution,
• FAT File system based on open source FatFS solution,
• STMTouch touch sensing library solution,
• STemWin, a professional graphical stack solution available in binary format and based
on ST partner solution SEGGER emWin.
Several applications and demonstrations implementing all these middleware components
are also provided in the STM32CubeF3 package.
670&XEH0;±,QLWLDOL]DWLRQ&FRGHJHQHUDWRU
3RUWDEOH3URJUDPPLQJ,QWHUIDFH±+DUGZDUH$EVWUDFWLRQ/D\HU0LGGOHZDUH572686%«
6701XFOHR
(YDOXDWLRQERDUGV 'LVFRYHU\ERDUGV 'HGLFDWHGERDUGV
ERDUGV
8WLOLWLHV
$SSOLFDWLRQOHYHOGHPRQVWUDWLRQV
7RXFK )$7ILOH
7&3,3 86% *UDSKLFV 5726 &06,6
/LEUDU\ V\VWHP
0LGGOHZDUHOHYHO 8WLOLWLHV
'ULYHUVOHYHO
+DUGZDUH
069
The STM32Cube firmware solution is built around three independent levels that can easily
interact with each other, as described in the Figure 2 below:
>ĞǀĞůϮ (YDOXDWLRQERDUGDQG'LVFRYHU\.LWGHPRQVWUDWLRQ
$SSOLFDWLRQV
>ĞǀĞůϭ
/LEUDU\DQGSURWRFROEDVHGFRPSRQHQWV
IRUH[DPSOH)DW)6)UHH572686%'HYLFH
([DPSOHV
>ĞǀĞůϬ %63GULYHUV
+DUGZDUHDEVWUDFWLRQOD\HU+$/
,>
06Y9
2.1 Level 0
This level is divided into three sub-layers:
• Board Support Package (BSP)
• Hardware Abstraction Layer (HAL)
– HAL peripheral drivers
– Low Layer drivers
• Basic peripheral usage examples
2.2 Level 1
This level is divided into two sub-layers:
• Middleware components
• Examples based on the middleware components
2.3 Level 2
This level is composed of a single layer, which is a global real-time and graphical
demonstration based on the middleware service layer, the low level abstraction layer and
the basic peripheral usage applications for board based functionalities.
STM32CubeF3 features a rich set of examples and applications at all levels making it easy
to understand and use any HAL driver and/or middleware components. These examples are
running on the STMicroelectronics boards listed in Table 2.
NUCLEO-F303RE STM32F303RE
STM32303E-EVAL STM32F303VE
32F3348DISCOVERY STM32F334C8
NUCLEO-F334R8 STM32F334R8
NUCLEO-F302R8 STM32F302R8
STM32373C-EVAL STM32F373VC
NUCLEO-F303K8 STM32F303K8
NUCLEO-F303ZE STM32F303ZE
STM32F3DISCOVERY STM32F303VC
STM32303C-EVAL STM32F303VC
%63GULYHUVIRUWKHVXSSRUWHGERDUGV
(YDOXDWLRQERDUGV
'LVFRYHU\NLW
1XFOHRNLW
&RQWDLQV670)[[&06,6ILOHV 'ULYHUVRIH[WHUQDOFRPSRQHQWV
WKDWGHILQHWKHSHULSKHUDOUHJLVWHU
GHFODUDWLRQVELWGHILQLWLRQVDQG
WKHDGGUHVVPDSSLQJ
670)[[+$/DQG//
GULYHUVIRUDOOSHULSKHUDOV
67HP:LQSURIHVVLRQDOVWDFN 7RXFK6HQVLQJ/LEUDU\
FRPLQJIURP6(**(5DQG
DYDLODEOHLQELQDU\IRUP
86%'HYLFH/LEUDU\RIIHULQJFODVVHV
+,'06&&'&DQG')8
6HWRI([DPSOHV$SSOLFDWLRQV
DQG'HPRQVWUDWLRQVRUJDQL]HG
E\ERDUGDQGSURYLGHGE\
SUHFRQILJXUHGSURMHFW 2SHQVRXUFHVPLGGOHZDUHVWDFNV
0LVFHOODQHRXVXWLOLWLHV
8VHUPRGLILDEOHILOHV
For each board, a set of examples are provided with pre-configured projects for EWARM,
MDK-ARM™, TrueSTUDIO® and SW4STM32 toolchains.
The examples are organized depending on the STM32Cube level they apply to, and are
named as described below:
• Examples in level 0 are called Examples, Examples_LL and Examples_MIX. They use,
respectively, HAL drivers, LL drivers and a mix of HAL and LL drivers without any
middleware component.
• Examples in level 1 are called Applications. They provide typical use cases of each
middleware component.
The template projects available in the Templates and Templates_LL directories allow to
quickly build any firmware application on a given board.
Templates_LL 1 1 1 1 1 1 1 1 1 1 10
Templates 1 1 1 1 1 1 1 1 1 1 10
Examples_MIX 0 0 0 9 1 0 0 0 0 0 10
Examples_LL 0 0 1 67 5 0 0 0 1 0 74
Examples 26 43 24 4 33 42 30 40 38 57 337
Demonstrations 1 0 1 1 1 0 1 1 1 0 7
Applications 8 19 1 1 3 22 1 3 3 16 77
Total 37 64 29 84 45 66 34 46 45 75 525
DocID026352 Rev 8
• SW4STM32
a) Open the SW4STM32 toolchain.
b) Click File->Switch Workspace->Other and browse to the SW4STM32
workspace directory.
c) Click File->Import, select General->'Existing Projects into Workspace' and
then click "Next".
d) Browse to the SW4STM32 workspace directory and select the project.
e) Rebuild all project files: select the project in the "Project explorer" window then
click Project->build project menu.
f) Run program: Run->Debug (F11).
4.2.2 LL application
This section describes the steps needed to create your own LL application using
STM32CubeF3.
1. Create your project
To create a new project you can either start from the Templates_LL project provided for
each board under \Projects\<STM32xxx_yyy>\Templates_LL or from any available
project under \Projects\<STM32xxy_yyy>\Examples_LL (<STM32xxx_yyy> refers to
the board name, such as NUCLEO-F334R8).
The Template project provides an empty main loop function, however it is a good
starting point to get familiar with project settings for STM32CubeF3.
Template main characteristics are the following:
– It contains the source codes of the LL and CMSIS drivers which are the minimal
components needed to develop code on a given board.
– It contains the include paths for all the required firmware components.
– It selects the supported STM32F3 device and allows to configure the CMSIS and
LL drivers accordingly.
– It provides ready-to-use user files, that are pre-configured as follows:
main.h : LED & USER_BUTTON definition abstraction layer.
main.c : System clock configuration for maximum frequency.
2. Port an existing project to another board
To port an existing project to another target board, start from the Templates_LL project
provided for each board and available under
\Projects\<STM32xxx_yyy>\Templates_LL:
a) Select a LL example
To find the board on which LL examples are deployed, refer to the list of LL
examples STM32CubeProjectsList.html, to Table 3: Number of examples
available for each board or to application note “STM32Cube firmware examples
for STM32F3 Series” (AN4734)
b) Port the LL example
– Copy/paste the Templates_LL folder - to keep the initial source - or directly update
existing Templates_LL project.
– Then porting consists principally in replacing Templates_LL files by the
Examples_LL targeted project.
– Keep all board specific parts. For reasons of clarity, board specific parts have been
flagged with specific tags:
/* ============== BOARD SPECIFIC CONFIGURATION CODE BEGIN ============== */
/* ============== BOARD SPECIFIC CONFIGURATION CODE END ============== */
Thus the main porting steps are the following:
– Replace the stm32F3xx_it.h file
– Replace the stm32F3xx_it.c file
– Replace the main.h file and update it: Keep the LED and user button definition of
the LL template under "BOARD SPECIFIC CONFIGURATION" tags.
5 FAQs
5.8 How can the user get regular updates on the latest
STM32CubeF3 firmware releases?
The STM32CubeF3 firmware package comes with an updater utility, STM32CubeUpdater,
that can be configured for automatic or on-demand checks for new firmware package
updates (new releases or/and patches).
STM32CubeUpdater is also integrated within the STM32CubeMX tool. When using this tool
for STM32F3 configuration and initialization C code generation, the user can benefit from
STM32CubeMX self-updates as well as STM32CubeF3 firmware package updates.
For more details, refer to Section 4.4.
6 Revision history
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and
improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on
ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order
acknowledgement.
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or
the design of Purchasers’ products.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.