Stm32f407vg-disc1 board -clock configuration (from scratch)

IDE used:

stm32 Cube IDE official

step1 > crete new project > c program and dont select stm32 project under type

types of clock:

  1. HSI- high speed internal
  2. HSE- high speed external
  3. PLL- phase locked loop

HSI 16MHZ setup without pll



@file : main.c
@author : Auto-generated by STM32CubeIDE
@brief : Main program body

© Copyright (c) 2020 STMicroelectronics.
All rights reserved.
This software component is licensed by ST under BSD 3-Clause license,
the "License"; You may not use this file except in compliance with the
License. You may obtain a copy of the License at:

if !defined(SOFT_FP) && defined(__ARM_FP)
#warning "FPU is not initialized, but the project is compiling for an FPU. Please initialize the FPU before use."
include "stdint.h"
define rcc_base_addr 0x40023800UL
define rcc_cr_offset 0x00U
define rcc_cfgr_offset 0x08U
define rcc_cr (rcc_base_addr+rcc_cr_offset)
define rcc_cfgr (rcc_base_addr+rcc_cfgr_offset)
int main(void)
//1. set rcc_cr hsion (bit 0)
uint32_t *rcccrreg = (uint32_t *)rcc_cr;
uint32_t *rcccfgrreg = (uint32_t *)rcc_cfgr;
*rcccrreg |=(0x01<<0); //set hsion 0bit
*rcccfgrreg &=~(0x03<<21); //21 and 22 bit rcc_cfgr reset
/* Loop forever */ for(;;);

Published by @mББocҜer

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website with
Get started
%d bloggers like this: