The Keil MDK-ARM Development Tools CD-ROM includes several example
programs that are configured for the Keil MCBSTM32E Board.
All examples are configured for two µVision targets:
Simulator - where the program runs in the software
MCBSTM32E - where the program runs from internal Flash
located on the microcontroller.
All examples use the same file structure:
Abstract.txt contains a short description of the
STM32F10x.s contains the startup code for the
STM32_Init.[c,h] contain the initialization of the
- Example dependent source code.
STMicroelectronics provides a firmware library with sample code
(C sources) but the examples described here do not use this library
(except LCD driver) to keep the executable as small as
Each example program is stored in a separate folder in
\KEIL\ARM\BOARDS\KEIL\MCBSTM32E\ along with project files that
help you quickly build the project and run the program.
The following example programs are installed automatically:
The Blinky project shows the combination of configuring peripherals
via STM32_Init.c and own initialization functions. GPIO, USART and
timer are configured via STM32_Init.c. DMA and ADC are set up with
a seperate initialisation function. The LEDs blink with a speed
depending on potentiometer position. SysTimer is used in interrupt
mode and ticks every 10ms. The color LCD display shows init message
and bargraph depending on potentiometer position. AD value is
output onto serial port USART2 (115200 baud, 8 data bits, no
parity, 1 stop bit) and LCD. AD is used with DMA and 12 bit
The Measure project shows the combination of configuring
peripherals via STM32_Init.c and own initialisation functions.
GPIO, USART and timer are configured via STM32_Init.c. DMA and ADC
are set up with a seperate initialization function. The Measure
program uses analog and digital inputs to simulate a datalogger. A
help menue is displayed using the serial port USART2. The value of
analog input POT1 and the state of Joystick are logged. Timer TIM3
is used in interrupt mode and ticks every 1ms. Serial port USART2
(115200 baud, 8 data bits, no parity, 1 stop bit) is used in
polling mode. AD is used with DMA and 12 bit resolution.
The RTX_Traffic project demonstrates the control of a traffic
light. The traffic light is timed and lets cars pass during a
specific time period. There is a pedestrial crossing button (User)
that lets pedestrians cross. The lights are connected to GPIO Port
B. This program uses RTX Kernel. Serial port USART2 (115200 baud, 8
data bits, no parity, 1 stop bit) is used in polling mode.
The USB Memory project is a demo program for an USB Memory based on
USB Mass Storage Class. The USB Memory is automatically recognized
by the host PC running Windows which will load a generic Mass
Storage driver. Read / write access is displayed using the board
The USBHID project is a demo for a USB Human Interface Device. The
USB HID is recognized by the host PC running Windows which will
load a generic HID driver. The board LEDs (PB8..PB13) and Push
Buttons (Joystick) can then be accessed from the PC through a
custom HID Client Program.
See also Application Note 195: Developing HID USB
Device Drivers For Embedded Systems.
More example projects and programs are available for
Board and it is easy to port these examples to Keil
MCBSTM32E Board. Main difference between the boards are the LCD,
the Push Buttons which are connected to different GPIO Ports and
the use of an other USART.