UM1561
User manual
STEVAL-ISV003V1: firmware user manual
Introduction
This document describes how the firmware to manage the 250 W micro-inverter demo
STEVAL-ISV003V1 has been developed. Starting from the block diagram, it shows in detail
the single function and provides a user guide for further code development.
October 2012
Doc ID 023556 Rev 1
1/39
www.st.com
Contents
UM1561
Contents
1
2
3
System overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Firmware workspace with IAR embedded workbench IDE . . . . . . . . . . 5
STM32F1xx microcontroller - several peripherals used to manage the
STEVAL-ISV003V1 demonstration board . . . . . . . . . . . . . . . . . . . . . . . . 7
STM32F1xx - internal peripherals for DC-DC section . . . . . . . . . . . . . . 8
STM32F1xx - internal peripherals for DC-AC section . . . . . . . . . . . . . 11
Data sensing section for the closed loop control . . . . . . . . . . . . . . . . 15
STM32F1xx MCU peripherals configuration . . . . . . . . . . . . . . . . . . . . . 21
Implementation of digital phase locked loop . . . . . . . . . . . . . . . . . . . . 23
Digital closed loop control and diagnostic functions implemented . . 27
MPPT - maximum power point algorithm . . . . . . . . . . . . . . . . . . . . . . . 33
Input/output protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4
5
6
7
8
9
10
11
12
2/39
Doc ID 023556 Rev 1
UM1561
List of figures
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
250 W microinverter - digital section based on STM32F1xx microcontroller . . . . . . . . . . . . 4
IAR embedded workbench IDE workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Description of the main hardware parts in STEVAL-ISV003V1 . . . . . . . . . . . . . . . . . . . . . . 7
Center alignment mode for TIM8 timer and trigger event for ADC . . . . . . . . . . . . . . . . . . . 11
Repetition counter settings for advanced timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
250W microinverter - firmware flow chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Doc ID 023556 Rev 1
3/39
System overview
UM1561
1
System overview
This demonstration board consists of an isolated interleaved boost DC-DC converter and a
mixed frequency full bridge inverter used to deliver sinusoidal current at 50 Hz or 60 Hz to
the grid. The board is provided with a digital control section, capable of controlling the grid-
connected operation as well as an MPPT (maximum power point tracking) algorithm. The
firmware has been implemented on a 32-bit STM32F1xx microcontroller, high-performance
ARM
®
Cortex™-M3 32-bit RISC core operating at a 72 MHz frequency, high-speed
embedded memories (512 Kbytes for Flash memory and 64 Kbytes of SRAM), and an
extensive range of enhanced I/Os and peripherals connected to two APB buses. The device
offers three 12-bit ADCs, four general-purpose 16-bit timers plus two advanced PWM
timers, as well as standard and advanced communication interfaces: two I2Cs, three SPIs,
two I2Ss, one SDIO, five USARTs, a USB and a CAN.
Figure 1.
250 W microinverter - digital section based on STM32F1xx
microcontroller
STM32
ARM
®
Cortex
™
-M3
32-bit
RISC core
AM15187v1
4/39
Doc ID 023556 Rev 1
UM1561
Firmware workspace with IAR embedded workbench IDE
2
Firmware workspace with IAR embedded workbench
IDE
Opening IAR workbench editor, the workspace “250 W microinverter grid connected”
appears as shown in
Figure 2:
Figure 2.
IAR embedded workbench IDE workspace
It is internally structured in several folders, in particular:
●
●
●
Doc: includes fw version file;
EWARMv5: includes cortexm3_macro.s (instruction wrappers for special Cortex-M3
instructions) and stm32f10x_vector.c (STM32F10x vector table for EWARM5);
FWLib: includes the firmware library with the .c file for each STM32F1xx internal
peripheral: for example, the stm32f10x_adc.c file provides all the ADC firmware
functions, stm32f10x_tim.c provides the TIM functions, and the same for other
peripherals;
User: includes all user-files developed;
Output: contains the “.map” and “.out” file.
●
●
Doc ID 023556 Rev 1
5/39