For designers of STM32 microcontroller applications, it is important to be able to easily
replace one microcontroller type by another one in the same product family. Migrating an
application to a different microcontroller is often needed, when product requirements grow,
putting extra demands on memory size, or increasing the number of I/Os. On the other
hand, cost reduction objectives may force you to switch to smaller components and shrink
the PCB area.
This application note is written to help you and analyze the steps you need to migrate from
an existing STM32F1 devices based design to STM32F2 devices. It groups together all the
most important information and lists the vital aspects that you need to address.
To migrate your application from STM32 F1 series to F2 series, you have to analyze the
hardware migration, the peripheral migration and the firmware migration.
AN3427
Application note
Migrating a microcontroller application
from STM32F1 to STM32F2 series
To benefit fully from the information in this application note, the user should be familiar with
the STM32 microcontroller family. Available from www.st.com.
●The STM32F1 family reference manuals (RM0008 and RM0041), the STM32F1
datasheets, and the STM32F1 Flash programming manuals (PM0075, PM0063 and
PM0068).
●The STM32F2 family reference manual (RM0033), the STM32F2 datasheets, and the
STM32F2 Flash programming manual (PM0059).
For an overview of the whole STM32 series and a comparision of the different features of
each STM32 product series, please refer to AN3364 'Migration and compatibility guidelines
for STM32 microcontroller applications'
All peripherals shares the same pins in the two families, but there are some minor
differences between packages.
In fact, the STM32 F2 series maintains a close compatibility with the whole STM32 F1
series. All functional pins are pin-to-pin compatible. The STM32 F2 series, however, are not
drop-in replacements for the STM32 F1 series: the two families do not have the same power
scheme, and so their power pins are different. Nonetheless, transition from the STM32 F1
series to the STM32 F2 series remains simple as only a few pins are impacted (impacted
pins are in bold in the table below).
Table 1.STM32 F1 series and STM32 F2 series pinout differences
As shown in Table 2 on page 9, there are three categories of peripherals. The common
peripherals are supported with the dedicated firmware library without any modification,
except if the peripheral instance is no longer present, you can change the instance and of
course all the related features (clock configuration, pin configuration, interrupt/DMA
request).
The modified peripherals such as: FLASH, ADC, RCC, DMA, GPIO and RTC are different
from the F1 series ones and should be updated to take advantage of the enhancements and
the new features in F2 series.
All these modified peripherals in the F2 series are enhancements in performance and
features designed to meet new market requirements and to fix some limitations present in
the F1 series.
3.1 STM32 product cross-compatibility
The STM32 series embeds a set of peripherals which can be classed in three categories:
●The first category is for the peripherals which are by definition common to all products.
Those peripherals are identical, so they have the same structure, registers and control
bits. There is no need to perform any firmware change to keep the same functionality at
the application level after migration. All the features and behavior remain the same.
●The second category is for the peripherals which are shared by all products but have
only minor differences (in general to support new features), so migration from one
product to another is very easy and does not need any significant new development
effort.
●The third category is for peripherals which have been considerably changed from one
product to another (new architecture, new features...). For this category of peripherals,
migration will require new development at application level.
Ta bl e 2 below gives a general overview of this classification:
Table 2.STM32 peripheral compatibility analysis F1 versus F2 series
Table 2.STM32 peripheral compatibility analysis F1 versus F2 series (continued)
Compatibility
PeripheralF1 series F2 series
CommentsPinoutSW compatibility
PWRYe sYe s +EnhancementNA
RCC
SPI
USARTYe sYe s +
I2C
TIM
DAC
Ethernet
SDIOYe sYe s +Limitation fixIdentical
USB OTG FS Ye sYe s +
RTC
ADC
Ye sYe s +EnhancementNAPartial compatibility
Ye sYe s +TI mode / Max baudrateIdentical
Limitation fix / Max baudrate /
One Sample Bit / Oversampling
by 8
Ye sYe s +Limitation fixIdentical
Ye sYe s +
Ye sYe s +DMA underrun interruptIdentical
Ye sYe s +
Ye sYes++New peripheral
Ye sYes++New peripheral
32-bit Counter in TIM2 and
TIM5
IEEE1588 v2 / Enhanced DMA
descriptor
- Dynamic trimming capability of
SOF framing period in Host
mode
- Embeds a VBUS sensing
control
Identical
Identical
Identical
Identical
Identical for the
same feature
Identical for the
same feature
Full compatibility for
the same feature
Full compatibility for
the same feature
Full compatibility for
the same feature
Full compatibility for
the same feature
Full compatibility for
the same feature
Full compatibility for
the same feature
Full compatibility for
the same feature
Full compatibility for
the same feature
Full compatibility for
the same feature
Not compatible
Partial compatibility
FLASH
DMA
GPIO
CEC
USB FS
Device
Crypto/hash
processor
RNG
DCMI
10/52Doc ID 019001 Rev 1
Ye sYes++New peripheralNANot compatible
Ye sYes++New peripheralNANot compatible
Ye sYes++New peripheralIdenticalNot compatible
Ye sNANANANA
Ye sNANANANA
NAYe sNANANA
NAYe sNANANA
NAYe sNANANA
AN3427Peripheral migration
Color key:
= New feature or new architecture (Yes++)
= Same feature, but specification change or enhancement (Yes+)
= Feature not available (NA)
Table 2.STM32 peripheral compatibility analysis F1 versus F2 series (continued)
Compatibility
PeripheralF1 series F2 series
CommentsPinoutSW compatibility
USB OTG HS NAYe sNANANA
SYSCFG
NAYe sNANANA
Doc ID 019001 Rev 111/52
Peripheral migrationAN3427
3.2 System architecture
STM32 F2 series are a new generation on STM32 with significant improvement in features
and performance with outstanding results: 150DMIPS at 120MHz and execution from Flash
equivalent to 0-wait state performance.
3.2.1 32-bit multi-AHB bus matrix
The 32-bit multi-AHB bus matrix interconnects all masters (CPU, DMA controllers, Ethernet,
USB HS) and slaves (Flash memory, 2 blocks of RAM, FSMC, AHB and APB peripherals)
and ensures seamless and efficient operation even when several high-speed peripherals
are working simultaneously. For instance, the core can access the Flash through the ART
Accelerator and the 112-Kbyte SRAM, while the DMA2 controller is transferring data from
the camera interface located on the AHB2 peripheral bus to an LCD connected to the
FSMC, and while the USB OTG High Speed interface is storing received data in the 16Kbyte SRAM block.
To free the full performance of the Cortex-M3 core, ST has developed a leading-edge 90 nm
process and a unique technology, the adaptive real-time ART Accelerator™. To release the
processor full 150 DMIPS performance at this frequency, the accelerator implements an
instruction prefetch queue and branch cache which increases program execution speed
from the 128-bit Flash memory. Based on the CoreMark benchmark, the performance
achieved thanks to the ART accelerator is equivalent to 0 wait state program execution from
Flash memory at a CPU frequency up to 120 MHz.
By default (after each device reset) the prefetch queue and branch cache are disabled, the
user can enable them using the PRFTEN, ICEN and DCEN bits in the FLASH_ACR register.
12/52Doc ID 019001 Rev 1
AN3427Peripheral migration
3.2.3 Dual SRAM
The 128KB of SRAM is made of 2 blocks; one 112KB and one 16KB. Both can be accessed
simultaneously by 2 masters in 0 WS (CPU, DMAs, Ethernet, USB HS).
The 16KB SRAM can be used as a buffer for high speed peripherals like USB-HS, Ethernet,
Camera, without impacting the CPU performance.
3.3 Memory mapping
The peripheral address mapping has been changed in the F2 series vs. F1 series, the main
change concerns the GPIOs which have been moved to the AHB bus instead of the APB
bus to allow them to operate at maximum speed.
The tables below provide the peripheral address mapping correspondence between F2 and
F1 series.
Table 3.IP bus mapping differences between STM32 F1 and STM32 F2 series
STM32 F2 series STM32 F1 series
Peripheral
BusBase addressBusBase address
FSMC RegistersAHB30xA0000000AHB0xA0000000
RNG
0x50060800
NANA
HASH0x50060400
CRYP0x50060000
DCMI0x50050000
USB OTG FS0x50000000AHB0x50000000
AHB2
NANA
NANA
NANA
Doc ID 019001 Rev 113/52
Peripheral migrationAN3427
Table 3.IP bus mapping differences between STM32 F1 and STM32 F2 series
STM32 F2 series STM32 F1 series
Peripheral
BusBase addressBusBase address
USB OTG HS
ETHERNET MAC 0x40028000
DMA20x400264000x40020400
DMA10x400260000x40020000
BKPSRAM0x40024000
Flash interface 0x40023C00
RCC0x400238000x40021000
CRC0x400230000x40023000
GPIO I0x40022000
GPIO H0x40021C00
GPIO G0x40021800
GPIO F0x400214000x40011C00
GPIO E0x400210000x40011800
GPIO D0x40020C000x40011400
GPIO C0x400208000x40011000
GPIO B0x400204000x40010C00
GPIO A0x400200000x40010800
TIM11
TIM100x400144000x40015000
TIM90x400140000x40014C00
EXTI0x40013C000x40010400
AHB1
APB2
0x40040000NANA
0x40028000
AHB
NANA
0x40022000
AHB
NANA
NANA
0x40012000
APB2
0x400148000x40015400
14/52Doc ID 019001 Rev 1
AN3427Peripheral migration
Table 3.IP bus mapping differences between STM32 F1 and STM32 F2 series
STM32 F2 series STM32 F1 series
Peripheral
BusBase addressBusBase address
SYSCFG
SPI10x40013000APB20x40013000
SDIO0x40012C00AHB0x40018000
ADC1 - ADC2 - ADC30x40012000APB2
APB2
USART60x40011400
USART10x40011000
TIM80x400104000x40013400
TIM10x400100000x40012C00
DAC0x40007400
PWR
CAN20x400068000x40006800
CAN10x400064000x40006400
I2C30x40005C00
I2C20x40005800
I2C10x400054000x40005400
UART50x400050000x40005000
UART40x40004C000x40004C00
0x40013800
0x400070000x40007000
NANA
NANA
APB2
APB1
NANA
ADC3 - 0x40013C00
ADC2 - 0x40012800
ADC1 - 0x40012400
0x40013800
0x40007400
0x40005800
USART3 0x400048000x40004800
USART20x400044000x40004400
SPI3 / I2S30x40003C000x40003C00
SPI2 / I2S20x400038000x40003800
IWDG0x400030000x40003000
WWDG0x40002C000x40002C00
RTC
TIM140x400020000x40002000
TIM130x40001C000x40001C00
TIM120x400018000x40001800
TIM70x400014000x40001400
TIM60x400010000x40001000
TIM50x40000C000x40000C00
TIM40x400008000x40000800
APB1
APB1
0x40002800
(inc. BKP registers)
Doc ID 019001 Rev 115/52
0x40002800
Peripheral migrationAN3427
Color key:
= Same feature, but base address change
= Feature not available (NA)
Table 3.IP bus mapping differences between STM32 F1 and STM32 F2 series
STM32 F2 series STM32 F1 series
Peripheral
BusBase addressBusBase address
TIM3
0x40000400
APB1
TIM20x400000000x40000000
APB1
BKP registersNANA0x40006C00
USB device FS
AFIO
NANA0x40005C00
NANAAPB20x40001000
3.4 RCC
The main differences related to the RCC (Reset and Clock Controller) in the STM32 F2
series vs. STM32 F1 series are presented in the table below.
Table 4.RCC differences between STM32 F1 and STM32 F2 series
RCC main
features
STM32 F1 seriesSTM32 F2 series Comments
0x40000400
HSI8 MHz RC factory-trimmed
LSI 40 KHz RC
16 MHz RC factory-trimmed
32 KHz RC
3 - 25 MHz
HSE
Depending on the product line
4 - 26MHz
used
LSE32.768 KHz32.768 kHz
No change to SW configuration:
– Enable/disable
RCC_CR[HSION]
– Status flag RCC_CR[HSIRDY]
No change to SW configuration:
– Enable/disable
RCC_CSR[LSION]
– Status flag
RCC_CSR[LSIRDY]
No change to SW configuration:
– Enable/disable
RCC_CR[HSEON]
– Status flag
RCC_CR[HSERDY]
No change to SW configuration:
– Enable/disable
RCC_BDCR[LSEON]
– Status flag
RCC_BDCR[LSERDY]
16/52Doc ID 019001 Rev 1
Loading...
+ 36 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.