Demo entry 6354625

C

   

Submitted by Zhou on Apr 10, 2017 at 05:53
Language: C++. Code size: 911 Bytes.

#include "stm32f10x.h"

u32 Stm32IdHigh = 0;
u32 Stm32IdMed = 0;
u32 Stm32IdLow = 0;
void RccInitialisation(void);

int main(void)
{
	RccInitialisation();
	Stm32IdLow = *((u32*)0x1FFFF7E8);
	Stm32IdMed = *((u32*)0x1FFFF7EC);
	Stm32IdHigh = *((u32*)0x1FFFF7F0);
	while(1);
}

void RccInitialisation(void)
{
	ErrorStatus HSEStartUpStatus;
	RCC_DeInit();
	RCC_HSEConfig(RCC_HSE_ON);
	HSEStartUpStatus = RCC_WaitForHSEStartUp();
	if(HSEStartUpStatus == SUCCESS){
		RCC_HCLKConfig(RCC_SYSCLK_Div1);
		RCC_PCLK2Config(RCC_HCLK_Div1);
		RCC_PCLK1Config(RCC_HCLK_Div2);
		FLASH_SetLatency(FLASH_Latency_2);
		FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
		RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
		RCC_PLLCmd(ENABLE);
		while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
		RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
		while(RCC_GetSYSCLKSource() != 0x08);
	}
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).