Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mozi
rt-thread
提交
e7df8119
R
rt-thread
项目概览
Mozi
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e7df8119
编写于
6月 29, 2018
作者:
L
liu2guang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bsp][stm32f10x] Fix compile error when configuring HSI. |修复当配置为HSI内部时钟做为时钟源时编译错误问题.
上级
614b2e38
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
47 addition
and
22 deletion
+47
-22
bsp/stm32f10x-HAL/drivers/board.c
bsp/stm32f10x-HAL/drivers/board.c
+43
-22
bsp/stm32f10x-HAL/drivers/stm32f1xx_hal_conf.h
bsp/stm32f10x-HAL/drivers/stm32f1xx_hal_conf.h
+4
-0
未找到文件。
bsp/stm32f10x-HAL/drivers/board.c
浏览文件 @
e7df8119
...
...
@@ -49,11 +49,12 @@ void HAL_MspInit(void)
void
SystemClock_Config
(
void
)
{
rt_err_t
re
sult
;
rt_err_t
re
t
=
RT_EOK
;
RCC_OscInitTypeDef
RCC_OscInitStruct
;
RCC_ClkInitTypeDef
RCC_ClkInitStruct
;
/**Initializes the CPU, AHB and APB busses clocks
*/
#if !defined(RT_USING_HSI)
/* Initializes the CPU, AHB and APB busses clocks */
RCC_OscInitStruct
.
OscillatorType
=
RCC_OSCILLATORTYPE_HSE
;
RCC_OscInitStruct
.
HSEState
=
RCC_HSE_ON
;
RCC_OscInitStruct
.
HSEPredivValue
=
RCC_HSE_PREDIV_DIV1
;
...
...
@@ -61,25 +62,45 @@ void SystemClock_Config(void)
RCC_OscInitStruct
.
PLL
.
PLLState
=
RCC_PLL_ON
;
RCC_OscInitStruct
.
PLL
.
PLLSource
=
RCC_PLLSOURCE_HSE
;
RCC_OscInitStruct
.
PLL
.
PLLMUL
=
RCC_PLL_MUL9
;
result
=
HAL_RCC_OscConfig
(
&
RCC_OscInitStruct
);
RT_ASSERT
(
result
==
HAL_OK
);
/**Initializes the CPU, AHB and APB busses clocks
*/
RCC_ClkInitStruct
.
ClockType
=
RCC_CLOCKTYPE_HCLK
|
RCC_CLOCKTYPE_SYSCLK
|
RCC_CLOCKTYPE_PCLK1
|
RCC_CLOCKTYPE_PCLK2
;
ret
=
HAL_RCC_OscConfig
(
&
RCC_OscInitStruct
);
RT_ASSERT
(
ret
==
HAL_OK
);
/* Initializes the CPU, AHB and APB busses clocks */
RCC_ClkInitStruct
.
ClockType
=
RCC_CLOCKTYPE_HCLK
|
RCC_CLOCKTYPE_SYSCLK
|
RCC_CLOCKTYPE_PCLK1
|
RCC_CLOCKTYPE_PCLK2
;
RCC_ClkInitStruct
.
SYSCLKSource
=
RCC_SYSCLKSOURCE_PLLCLK
;
RCC_ClkInitStruct
.
AHBCLKDivider
=
RCC_SYSCLK_DIV1
;
RCC_ClkInitStruct
.
APB1CLKDivider
=
RCC_HCLK_DIV2
;
RCC_ClkInitStruct
.
APB2CLKDivider
=
RCC_HCLK_DIV1
;
result
=
HAL_RCC_ClockConfig
(
&
RCC_ClkInitStruct
,
FLASH_LATENCY_2
);
RT_ASSERT
(
result
==
HAL_OK
);
/**Configure the Systick interrupt time
*/
ret
=
HAL_RCC_ClockConfig
(
&
RCC_ClkInitStruct
,
FLASH_LATENCY_2
);
RT_ASSERT
(
ret
==
HAL_OK
);
HAL_SYSTICK_Config
(
HAL_RCC_GetHCLKFreq
()
/
RT_TICK_PER_SECOND
);
/**Configure the Systick
*/
HAL_SYSTICK_CLKSourceConfig
(
SYSTICK_CLKSOURCE_HCLK
);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority
(
SysTick_IRQn
,
15
,
0
);
#else
RCC_OscInitStruct
.
OscillatorType
=
RCC_OSCILLATORTYPE_HSI
;
RCC_OscInitStruct
.
HSIState
=
RCC_HSI_ON
;
RCC_OscInitStruct
.
HSICalibrationValue
=
16
;
RCC_OscInitStruct
.
PLL
.
PLLState
=
RCC_PLL_ON
;
RCC_OscInitStruct
.
PLL
.
PLLSource
=
RCC_PLLSOURCE_HSI_DIV2
;
RCC_OscInitStruct
.
PLL
.
PLLMUL
=
RCC_PLL_MUL16
;
ret
=
HAL_RCC_OscConfig
(
&
RCC_OscInitStruct
);
RT_ASSERT
(
ret
==
HAL_OK
);
RCC_ClkInitStruct
.
ClockType
=
RCC_CLOCKTYPE_HCLK
|
RCC_CLOCKTYPE_SYSCLK
|
RCC_CLOCKTYPE_PCLK1
|
RCC_CLOCKTYPE_PCLK2
;
RCC_ClkInitStruct
.
SYSCLKSource
=
RCC_SYSCLKSOURCE_PLLCLK
;
RCC_ClkInitStruct
.
AHBCLKDivider
=
RCC_SYSCLK_DIV1
;
RCC_ClkInitStruct
.
APB1CLKDivider
=
RCC_HCLK_DIV2
;
RCC_ClkInitStruct
.
APB2CLKDivider
=
RCC_HCLK_DIV1
;
ret
=
HAL_RCC_ClockConfig
(
&
RCC_ClkInitStruct
,
FLASH_LATENCY_2
);
RT_ASSERT
(
ret
==
HAL_OK
);
HAL_SYSTICK_Config
(
HAL_RCC_GetHCLKFreq
()
/
RT_TICK_PER_SECOND
);
HAL_SYSTICK_CLKSourceConfig
(
SYSTICK_CLKSOURCE_HCLK
);
HAL_NVIC_SetPriority
(
SysTick_IRQn
,
15
,
0
);
#endif
}
/**
...
...
bsp/stm32f10x-HAL/drivers/stm32f1xx_hal_conf.h
浏览文件 @
e7df8119
...
...
@@ -103,7 +103,11 @@ extern "C" {
* This value is used by the RCC HAL module to compute the system frequency
* (when HSE is used as system clock source, directly or through the PLL).
*/
#if !defined(RT_USING_HSI)
#define HSE_VALUE ((unsigned int)RT_HSE_VALUE)
#endif
//#define HSE_VALUE ((unsigned int)RT_HSE_VALUE)
#if !defined (HSE_VALUE)
#if defined(USE_STM3210C_EVAL)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录