ST AN3268 Application note

AN3268
Application note
STM32VLDISCOVERY firmware package
Introduction
The purpose of this application note is to describe the STM32VLDISCOVERY package structure and provide short descriptions of:
STM32VLDISCOVERY firmware demonstration.
Standard firmware library.
The STM32VLDISCOVERY firmware package is available from http://www.st.com/stm32vldiscovery.
September 2010 Doc ID 17901 Rev 1 1/16
www.st.com
Contents AN3268
Contents
1 Package structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1 Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.1 CMSIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.2 STM32F10x_StdPeriph_Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 STM32VLDISCOVERY firmware examples . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 GPIO toggle example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 RCC (reset and clock control) example . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 EXTI example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 SysTick example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.5 Low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.5.1 Standby mode example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.5.2 Stop mode example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5.3 Sleep mode example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.6 DMA example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.6.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.6.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.7 Flash program example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.7.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.7.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.8 IWDG (independant watchdog) example . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.8.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.8.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2/16 Doc ID 17901 Rev 1
AN3268 Contents
2.9 WWDG (window watchdog) example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.9.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.9.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.10 JTAG remap example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.10.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.10.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3 STM32VLDISCOVERY demonstration overview . . . . . . . . . . . . . . . . . . 14
4 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Doc ID 17901 Rev 1 3/16
Package structure AN3268

1 Package structure

ST provides a complete development package, the STM32vldiscovery_package, which allows users to get started easily with the STM32VLDISCOVERY board by simplifying application code development and execution using the standard peripheral drivers.
This package can be downloaded, together with the user manual, from http://www.st.com/stm32vldiscovery.
The package is structured as shown in Figure 1.

Figure 1. Stm32vldiscovery_package content

1.1 Libraries

This folder contains all the CMSIS files and the STM32F10x standard peripheral's drivers.
CMSIS subfolder: Contains the STM32F10xxx CMSIS files: Device Peripheral Access
Layer and Core Peripheral Access Layer.
STM32F10x_StdPeriph_Driver subfolder: Contains all the subdirectories and files that
make up the core of the library.
4/16 Doc ID 17901 Rev 1
AN3268 Package structure

1.1.1 CMSIS

CMSIS (Cortex microcontroller software interface standard) answers the challenges that are faced when software components are deployed to physical microcontroller devices based on a Cortex-M0 or Cortex-M3 processor. It is defined in close co-operation with various silicon and software vendors and provides a common approach to interface with peripherals, real­time operating systems, and middleware components.
ARM provides as part of the CMSIS the following software layers that are available for various compiler implementations:
Core Peripheral Access Layer: contains name definitions, address definitions and
helper functions to access core registers and peripherals. It defines also a device independent interface for RTOS Kernels that includes debug channel definitions. This software layer is expanded by Silicon partners with:
Device Peripheral Access Layer: provides definitions for all device peripherals.
Access functions for peripherals (optional): provides additional helper functions for
peripherals.
CMSIS defines for a Cortex-M microcontroller system:
A common way to access peripheral registers.
A common way to define exception vectors.
Register names of the core peripherals and the names of the core exception vectors.
An device independent interface for RTOS kernels including a debug channel.
By using CMSIS compliant software components, the user can easier re-use template code. CMSIS enables the combination of software components from multiple middleware vendors.

1.1.2 STM32F10x_StdPeriph_Driver

This driver corresponds to the STM32F10x Standard Peripherals Library: http://www.st.com/stonline/products/support/micro/files/stm32f10x_stdperiph_lib.zip.
It is a complete firmware package, consisting of device drivers for all of the standard device peripherals, for STM32 value line (medium and low), Connectivity line, XL-, high-, medium­and low- density device 32-bit Flash microcontrollers. The device drivers contain a collection of routines, data structures and macros covering the features of STM32 peripherals. It includes a description of the device drivers plus a set of examples for each peripheral. The firmware library allows any device to be used in the user application without the need for in-depth study of each peripheral’s specification.
Using the Standard Peripherals Library has two advantages: it saves significant time that would otherwise be spent in coding, while simultaneously reducing application development and integration costs.
The STM32F10x Standard Peripherals library covers 3 abstraction levels, and includes:
A complete register address mapping with all bits, bit fields and registers declared in C.
This avoids a cumbersome task and more important, it brings the benefits of a bug free reference mapping file, speeding up the early project phase.
A collection of routines and data structures which covers all peripheral functions
(drivers with common API). It can be used directly as a reference framework, since it also includes macros for supporting core-related intrinsic features and common constants and data type definitions.
Doc ID 17901 Rev 1 5/16
Loading...
+ 11 hidden pages