Electronic Components Datasheet Search
  English  ▼

X  

AN3422 Datasheet(PDF) 22 Page - STMicroelectronics

Part # AN3422
Description  Migration of microcontroller applications from STM32F1 to STM32L1 series
PDF  52 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN3422 Datasheet(HTML) 22 Page - STMicroelectronics

Back Button AN3422 Datasheet HTML 18Page - STMicroelectronics AN3422 Datasheet HTML 19Page - STMicroelectronics AN3422 Datasheet HTML 20Page - STMicroelectronics AN3422 Datasheet HTML 21Page - STMicroelectronics AN3422 Datasheet HTML 22Page - STMicroelectronics AN3422 Datasheet HTML 23Page - STMicroelectronics AN3422 Datasheet HTML 24Page - STMicroelectronics AN3422 Datasheet HTML 25Page - STMicroelectronics AN3422 Datasheet HTML 26Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 22 / 52 page
background image
Peripheral migration
AN3422
22/52
Doc ID 018976 Rev 2
Table 7.
Example of migrating system clock configuration code from F1 to L1
STM32F105/7 running at 72 MHz (PLL as clock
source) with 2 wait states
STM32L1xx running at 22 MHz (PLL as clock source)
with 1 wait state
/* Enable HSE ----------------------------*/
RCC->CR |= ((uint32_t)RCC_CR_HSEON);
/* Wait till HSE is ready */
while((RCC->CR & RCC_CR_HSERDY) == 0)
{
}
/* Flash configuration -------------------*/
/* Prefetch ON, Flash 2 wait states */
FLASH->ACR |= FLASH_ACR_PRFTBE |
FLASH_ACR_LATENCY_2;
/* AHB and APB prescaler configuration --*/
/* HCLK = SYSCLK */
RCC->CFGR |= RCC_CFGR_HPRE_DIV1;
/* PCLK2 = HCLK */
RCC->CFGR |= RCC_CFGR_PPRE2_DIV1;
/* PCLK1 = HCLK */
RCC->CFGR |= RCC_CFGR_PPRE1_DIV2;
/* PLL configuration -------------------*/
/* PLL2CLK = (HSE / 5) * 8 = 40 MHz
PREDIV1CLK = PLL2 / 5 = 8 MHz */
RCC->CFGR2 |= RCC_CFGR2_PREDIV2_DIV5 |
RCC_CFGR2_PLL2MUL8 |
RCC_CFGR2_PREDIV1SRC_PLL2 |
RCC_CFGR2_PREDIV1_DIV5;
/* Enable PLL2 */
RCC->CR |= RCC_CR_PLL2ON;
/* Wait till PLL2 is ready */
while((RCC->CR & RCC_CR_PLL2RDY) == 0)
{
}
/* PLLCLK = PREDIV1 * 9 = 72 MHz */
RCC->CFGR |= RCC_CFGR_PLLXTPRE_PREDIV1 |
RCC_CFGR_PLLSRC_PREDIV1 |
RCC_CFGR_PLLMULL9;
/* Enable the main PLL */
RCC->CR |= RCC_CR_PLLON;
/* Wait till the main PLL is ready */
while((RCC->CR & RCC_CR_PLLRDY) == 0)
{
}
/* Main PLL used as system clock source --*/
RCC->CFGR |= RCC_CFGR_SW_PLL;
/* Wait till the main PLL is used as system
clock source */
while ((RCC->CFGR & RCC_CFGR_SWS) !=
RCC_CFGR_SWS_PLL)
{
}
/* Enable HSE ----------------------------*/
RCC->CR |= ((uint32_t)RCC_CR_HSEON);
/* Wait till HSE is ready */
while((RCC->CR & RCC_CR_HSERDY) == 0)
{
}
/* Flash configuration -------------------*/
/* Flash prefetch and 64-bit access ON, Flash 1 wait
state */
FLASH->ACR |= FLASH_ACR_ACC64;
FLASH->ACR |= FLASH_ACR_PRFTEN;
FLASH->ACR |= FLASH_ACR_LATENCY;
/* Power enable */
RCC->APB1ENR |= RCC_APB1ENR_PWREN;
/* Select the Voltage Range 1 (1.8 V) */
PWR->CR = PWR_CR_VOS_0;
/* Wait Until the Voltage Regulator is ready */
while((PWR->CSR & PWR_CSR_VOSF) != RESET)
{
}
/* AHB and APB prescaler configuration --*/
/* HCLK = SYSCLK */
RCC->CFGR |= RCC_CFGR_HPRE_DIV1;
/* PCLK2 = HCLK / 1*/
RCC->CFGR |= RCC_CFGR_PPRE2_DIV1;
/* PCLK1 = HCLK / 1*/
RCC->CFGR |= RCC_CFGR_PPRE1_DIV1;
/* PLL configuration ---------------------*/
/*
PLLCLK = (HSE * PLL_MUL) / PLL_DIV
= (8 MHz * 12) / 3
= 32MHz */
RCC->CFGR = RCC_CFGR_PLLSRC_HSE | RCC_CFGR_PLLMUL12
| RCC_CFGR_PLLDIV3;
/* Enable the main PLL */
RCC->CR |= RCC_CR_PLLON;
/* Wait till the main PLL is ready */
while((RCC->CR & RCC_CR_PLLRDY) == 0)
{
}
/* Main PLL used as system clock source --*/
RCC->CFGR |= RCC_CFGR_SW_PLL;
/* Wait till the main PLL is used as system
clock source */
while ((RCC->CFGR & RCC_CFGR_SWS ) !=
RCC_CFGR_SWS_PLL);
{
}



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com