Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ihbai
rt-thread
提交
7cf7841c
R
rt-thread
项目概览
ihbai
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
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,发现更多精彩内容 >>
未验证
提交
7cf7841c
编写于
4月 13, 2020
作者:
B
Bernard Xiong
提交者:
GitHub
4月 13, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3510 from whj4674672/master
增加stm32h743-atk-apollo对pcf8574 和 uart2的支持
上级
5c399d50
32d13e38
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
247 addition
and
73 deletion
+247
-73
bsp/stm32/stm32h743-atk-apollo/README.md
bsp/stm32/stm32h743-atk-apollo/README.md
+3
-2
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/CubeMX_Config.ioc
...tm32h743-atk-apollo/board/CubeMX_Config/CubeMX_Config.ioc
+75
-64
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/Inc/stm32h7xx_hal_conf.h
...3-atk-apollo/board/CubeMX_Config/Inc/stm32h7xx_hal_conf.h
+1
-1
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/Inc/stm32h7xx_it.h
...m32h743-atk-apollo/board/CubeMX_Config/Inc/stm32h7xx_it.h
+1
-0
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/Src/main.c
...stm32/stm32h743-atk-apollo/board/CubeMX_Config/Src/main.c
+56
-3
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/Src/stm32h7xx_hal_msp.c
...43-atk-apollo/board/CubeMX_Config/Src/stm32h7xx_hal_msp.c
+61
-0
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/Src/stm32h7xx_it.c
...m32h743-atk-apollo/board/CubeMX_Config/Src/stm32h7xx_it.c
+15
-0
bsp/stm32/stm32h743-atk-apollo/board/Kconfig
bsp/stm32/stm32h743-atk-apollo/board/Kconfig
+31
-1
bsp/stm32/stm32h743-atk-apollo/board/board.c
bsp/stm32/stm32h743-atk-apollo/board/board.c
+4
-2
未找到文件。
bsp/stm32/stm32h743-atk-apollo/README.md
浏览文件 @
7cf7841c
...
...
@@ -41,10 +41,11 @@
|
**板载外设**
|
**支持情况**
|
**备注**
|
| :----------------- | :----------: | :------------------------------------- |
| USB 转串口 | 支持 | |
| COM2 | 支持 | |
| QSPI Flash | 支持 | |
| 以太网 | 暂不支持 | |
| SD卡 | 暂不支持 | |
| CAN
| 暂不支持 | |
| CAN
-FD
| 暂不支持 | |
| SDRAM | 支持 | |
| LCD | 支持 | |
| MPU9250六轴传感器 | 暂不支持 | |
...
...
@@ -52,7 +53,7 @@
| GPIO | 支持 | PA0, PA1... PK15 ---> PIN: 0, 1...176 |
| UART | 支持 | |
| SPI | 支持 | SPI2 |
| I2C |
暂不支持 |
|
| I2C |
支持 | PCF8574
|
| SDIO | 暂不支持 | |
| RTC | 支持 | |
| PWM | 暂不支持 | |
...
...
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/CubeMX_Config.ioc
浏览文件 @
7cf7841c
...
...
@@ -26,6 +26,7 @@ Mcu.IP1=DEBUG
Mcu.IP10=SPI2
Mcu.IP11=SYS
Mcu.IP12=USART1
Mcu.IP13=USART2
Mcu.IP2=DMA2D
Mcu.IP3=FMC
Mcu.IP4=IWDG1
...
...
@@ -34,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Mcu.Pin70=P
G11
Mcu.Pin71=P
G15
Mcu.Pin72=P
B6
Mcu.Pin73=P
E0
Mcu.Pin74=P
E1
Mcu.Pin75=PI
4
Mcu.Pin76=PI
5
Mcu.Pin77=
PI6
Mcu.Pin78=
PI7
Mcu.Pin79=VP_
DMA2D_VS_DMA2D
Mcu.Pin8=PF3
Mcu.Pin80=VP_SYS_VS_Systick
Mcu.Pin80=VP_IWDG1_VS_IWDG
Mcu.Pin81=VP_RTC_VS_RTC_Activate
Mcu.Pin82=VP_SYS_VS_Systick
Mcu.Pin9=PF4
Mcu.PinsNb=8
1
Mcu.PinsNb=8
3
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32H743IITx
...
...
@@ -126,6 +129,7 @@ MxCube.Version=5.3.0
MxDb.Version=DB.5.0.30
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.ForceEnableDMAVector=true
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false
...
...
@@ -134,6 +138,7 @@ NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
PA10.Locked=true
PA10.Mode=Asynchronous
...
...
@@ -142,6 +147,10 @@ PA13\ (JTMS/SWDIO).Mode=Serial_Wire
PA13\ (JTMS/SWDIO).Signal=DEBUG_JTMS-SWDIO
PA14\ (JTCK/SWCLK).Mode=Serial_Wire
PA14\ (JTCK/SWCLK).Signal=DEBUG_JTCK-SWCLK
PA2.Mode=Asynchronous
PA2.Signal=USART2_TX
PA3.Mode=Asynchronous
PA3.Signal=USART2_RX
PA9.Locked=true
PA9.Mode=Asynchronous
PA9.Signal=USART1_TX
...
...
@@ -301,7 +310,7 @@ PI7.Signal=LTDC_B7
PI9.Mode=RGB565
PI9.Signal=LTDC_VSYNC
PinOutPanel.RotationAngle=0
ProjectManager.AskForMigrate=
tru
e
ProjectManager.AskForMigrate=
fals
e
ProjectManager.BackupPrevious=false
ProjectManager.CompilerOptimize=6
ProjectManager.ComputerToolchain=false
...
...
@@ -327,7 +336,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=MDK-ARM V5
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_FMC_Init-FMC-false-HAL-true,6-MX_DMA2D_Init-DMA2D-false-HAL-true,7-MX_LTDC_Init-LTDC-false-HAL-true,8-MX_RTC_Init-RTC-false-HAL-true,9-MX_IWDG1_Init-IWDG1-false-HAL-true,10-MX_QUADSPI_Init-QUADSPI-false-HAL-true,11-MX_SPI2_Init-SPI2-false-HAL-true
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_FMC_Init-FMC-false-HAL-true,6-MX_DMA2D_Init-DMA2D-false-HAL-true,7-MX_LTDC_Init-LTDC-false-HAL-true,8-MX_RTC_Init-RTC-false-HAL-true,9-MX_IWDG1_Init-IWDG1-false-HAL-true,10-MX_QUADSPI_Init-QUADSPI-false-HAL-true,11-MX_SPI2_Init-SPI2-false-HAL-true
,12-MX_USART2_UART_Init-USART2-false-HAL-true
RCC.ADCFreq_Value=50390625
RCC.AHB12Freq_Value=200000000
RCC.AHB4Freq_Value=200000000
...
...
@@ -493,6 +502,8 @@ SPI2.Mode=SPI_MODE_MASTER
SPI2.VirtualType=VM_MASTER
USART1.IPParameters=VirtualMode-Asynchronous
USART1.VirtualMode-Asynchronous=VM_ASYNC
USART2.IPParameters=VirtualMode-Asynchronous
USART2.VirtualMode-Asynchronous=VM_ASYNC
VP_DMA2D_VS_DMA2D.Mode=DMA2D_Activate
VP_DMA2D_VS_DMA2D.Signal=DMA2D_VS_DMA2D
VP_IWDG1_VS_IWDG.Mode=IWDG_Activate
...
...
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/Inc/stm32h7xx_hal_conf.h
浏览文件 @
7cf7841c
...
...
@@ -151,7 +151,7 @@
#define VDD_VALUE ((uint32_t)3300U)
/*!< Value of VDD in mv */
#define TICK_INT_PRIORITY ((uint32_t)0U)
/*!< tick interrupt priority */
#define USE_RTOS 0U
#define USE_SD_TRANSCEIVER
1
U
/*!< use uSD Transceiver */
#define USE_SD_TRANSCEIVER
0
U
/*!< use uSD Transceiver */
#define USE_HAL_ADC_REGISTER_CALLBACKS 0U
/* ADC register callback disabled */
#define USE_HAL_CEC_REGISTER_CALLBACKS 0U
/* CEC register callback disabled */
...
...
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/Inc/stm32h7xx_it.h
浏览文件 @
7cf7841c
...
...
@@ -72,6 +72,7 @@ void DebugMon_Handler(void);
void
PendSV_Handler
(
void
);
void
SysTick_Handler
(
void
);
void
USART1_IRQHandler
(
void
);
void
USART2_IRQHandler
(
void
);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
...
...
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/Src/main.c
浏览文件 @
7cf7841c
...
...
@@ -76,6 +76,7 @@ RTC_HandleTypeDef hrtc;
SPI_HandleTypeDef
hspi2
;
UART_HandleTypeDef
huart1
;
UART_HandleTypeDef
huart2
;
SDRAM_HandleTypeDef
hsdram1
;
...
...
@@ -94,6 +95,7 @@ static void MX_RTC_Init(void);
static
void
MX_IWDG1_Init
(
void
);
static
void
MX_QUADSPI_Init
(
void
);
static
void
MX_SPI2_Init
(
void
);
static
void
MX_USART2_UART_Init
(
void
);
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
...
...
@@ -146,6 +148,7 @@ int main(void)
MX_IWDG1_Init
();
MX_QUADSPI_Init
();
MX_SPI2_Init
();
MX_USART2_UART_Init
();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
...
...
@@ -225,8 +228,9 @@ void SystemClock_Config(void)
Error_Handler
();
}
PeriphClkInitStruct
.
PeriphClockSelection
=
RCC_PERIPHCLK_RTC
|
RCC_PERIPHCLK_LTDC
|
RCC_PERIPHCLK_USART1
|
RCC_PERIPHCLK_SPI2
|
RCC_PERIPHCLK_QSPI
|
RCC_PERIPHCLK_FMC
;
|
RCC_PERIPHCLK_USART2
|
RCC_PERIPHCLK_USART1
|
RCC_PERIPHCLK_SPI2
|
RCC_PERIPHCLK_QSPI
|
RCC_PERIPHCLK_FMC
;
PeriphClkInitStruct
.
PLL3
.
PLL3M
=
5
;
PeriphClkInitStruct
.
PLL3
.
PLL3N
=
160
;
PeriphClkInitStruct
.
PLL3
.
PLL3P
=
2
;
...
...
@@ -238,6 +242,7 @@ void SystemClock_Config(void)
PeriphClkInitStruct
.
FmcClockSelection
=
RCC_FMCCLKSOURCE_D1HCLK
;
PeriphClkInitStruct
.
QspiClockSelection
=
RCC_QSPICLKSOURCE_D1HCLK
;
PeriphClkInitStruct
.
Spi123ClockSelection
=
RCC_SPI123CLKSOURCE_PLL
;
PeriphClkInitStruct
.
Usart234578ClockSelection
=
RCC_USART234578CLKSOURCE_D2PCLK1
;
PeriphClkInitStruct
.
Usart16ClockSelection
=
RCC_USART16CLKSOURCE_D2PCLK2
;
PeriphClkInitStruct
.
RTCClockSelection
=
RCC_RTCCLKSOURCE_LSE
;
if
(
HAL_RCCEx_PeriphCLKConfig
(
&
PeriphClkInitStruct
)
!=
HAL_OK
)
...
...
@@ -558,6 +563,54 @@ static void MX_USART1_UART_Init(void)
}
/**
* @brief USART2 Initialization Function
* @param None
* @retval None
*/
static
void
MX_USART2_UART_Init
(
void
)
{
/* USER CODE BEGIN USART2_Init 0 */
/* USER CODE END USART2_Init 0 */
/* USER CODE BEGIN USART2_Init 1 */
/* USER CODE END USART2_Init 1 */
huart2
.
Instance
=
USART2
;
huart2
.
Init
.
BaudRate
=
115200
;
huart2
.
Init
.
WordLength
=
UART_WORDLENGTH_8B
;
huart2
.
Init
.
StopBits
=
UART_STOPBITS_1
;
huart2
.
Init
.
Parity
=
UART_PARITY_NONE
;
huart2
.
Init
.
Mode
=
UART_MODE_TX_RX
;
huart2
.
Init
.
HwFlowCtl
=
UART_HWCONTROL_NONE
;
huart2
.
Init
.
OverSampling
=
UART_OVERSAMPLING_16
;
huart2
.
Init
.
OneBitSampling
=
UART_ONE_BIT_SAMPLE_DISABLE
;
huart2
.
Init
.
ClockPrescaler
=
UART_PRESCALER_DIV1
;
huart2
.
AdvancedInit
.
AdvFeatureInit
=
UART_ADVFEATURE_NO_INIT
;
if
(
HAL_UART_Init
(
&
huart2
)
!=
HAL_OK
)
{
Error_Handler
();
}
if
(
HAL_UARTEx_SetTxFifoThreshold
(
&
huart2
,
UART_TXFIFO_THRESHOLD_1_8
)
!=
HAL_OK
)
{
Error_Handler
();
}
if
(
HAL_UARTEx_SetRxFifoThreshold
(
&
huart2
,
UART_RXFIFO_THRESHOLD_1_8
)
!=
HAL_OK
)
{
Error_Handler
();
}
if
(
HAL_UARTEx_DisableFifoMode
(
&
huart2
)
!=
HAL_OK
)
{
Error_Handler
();
}
/* USER CODE BEGIN USART2_Init 2 */
/* USER CODE END USART2_Init 2 */
}
/* FMC initialization function */
static
void
MX_FMC_Init
(
void
)
{
...
...
@@ -618,11 +671,11 @@ static void MX_GPIO_Init(void)
__HAL_RCC_GPIOI_CLK_ENABLE
();
__HAL_RCC_GPIOF_CLK_ENABLE
();
__HAL_RCC_GPIOH_CLK_ENABLE
();
__HAL_RCC_GPIOA_CLK_ENABLE
();
__HAL_RCC_GPIOB_CLK_ENABLE
();
__HAL_RCC_GPIOG_CLK_ENABLE
();
__HAL_RCC_GPIOE_CLK_ENABLE
();
__HAL_RCC_GPIOD_CLK_ENABLE
();
__HAL_RCC_GPIOA_CLK_ENABLE
();
}
...
...
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/Src/stm32h7xx_hal_msp.c
浏览文件 @
7cf7841c
...
...
@@ -382,6 +382,7 @@ void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef* hqspi)
*/
void
HAL_RTC_MspInit
(
RTC_HandleTypeDef
*
hrtc
)
{
GPIO_InitTypeDef
GPIO_InitStruct
=
{
0
};
if
(
hrtc
->
Instance
==
RTC
)
{
/* USER CODE BEGIN RTC_MspInit 0 */
...
...
@@ -389,6 +390,13 @@ void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
/* USER CODE END RTC_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_RTC_ENABLE
();
__HAL_RCC_GPIOC_CLK_ENABLE
();
/**RTC GPIO Configuration
PC13 ------> RTC_OUT_CALIB
*/
HAL_GPIO_Init
(
GPIOC
,
&
GPIO_InitStruct
);
/* USER CODE BEGIN RTC_MspInit 1 */
/* USER CODE END RTC_MspInit 1 */
...
...
@@ -411,6 +419,12 @@ void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc)
/* USER CODE END RTC_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_RTC_DISABLE
();
/**RTC GPIO Configuration
PC13 ------> RTC_OUT_CALIB
*/
HAL_GPIO_DeInit
(
GPIOC
,
GPIO_PIN_13
);
/* USER CODE BEGIN RTC_MspDeInit 1 */
/* USER CODE END RTC_MspDeInit 1 */
...
...
@@ -521,6 +535,33 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
/* USER CODE END USART1_MspInit 1 */
}
else
if
(
huart
->
Instance
==
USART2
)
{
/* USER CODE BEGIN USART2_MspInit 0 */
/* USER CODE END USART2_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_USART2_CLK_ENABLE
();
__HAL_RCC_GPIOA_CLK_ENABLE
();
/**USART2 GPIO Configuration
PA2 ------> USART2_TX
PA3 ------> USART2_RX
*/
GPIO_InitStruct
.
Pin
=
GPIO_PIN_2
|
GPIO_PIN_3
;
GPIO_InitStruct
.
Mode
=
GPIO_MODE_AF_PP
;
GPIO_InitStruct
.
Pull
=
GPIO_NOPULL
;
GPIO_InitStruct
.
Speed
=
GPIO_SPEED_FREQ_LOW
;
GPIO_InitStruct
.
Alternate
=
GPIO_AF7_USART2
;
HAL_GPIO_Init
(
GPIOA
,
&
GPIO_InitStruct
);
/* USART2 interrupt Init */
HAL_NVIC_SetPriority
(
USART2_IRQn
,
0
,
0
);
HAL_NVIC_EnableIRQ
(
USART2_IRQn
);
/* USER CODE BEGIN USART2_MspInit 1 */
/* USER CODE END USART2_MspInit 1 */
}
}
...
...
@@ -552,6 +593,26 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
/* USER CODE END USART1_MspDeInit 1 */
}
else
if
(
huart
->
Instance
==
USART2
)
{
/* USER CODE BEGIN USART2_MspDeInit 0 */
/* USER CODE END USART2_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_USART2_CLK_DISABLE
();
/**USART2 GPIO Configuration
PA2 ------> USART2_TX
PA3 ------> USART2_RX
*/
HAL_GPIO_DeInit
(
GPIOA
,
GPIO_PIN_2
|
GPIO_PIN_3
);
/* USART2 interrupt DeInit */
HAL_NVIC_DisableIRQ
(
USART2_IRQn
);
/* USER CODE BEGIN USART2_MspDeInit 1 */
/* USER CODE END USART2_MspDeInit 1 */
}
}
...
...
bsp/stm32/stm32h743-atk-apollo/board/CubeMX_Config/Src/stm32h7xx_it.c
浏览文件 @
7cf7841c
...
...
@@ -72,6 +72,7 @@
/* External variables --------------------------------------------------------*/
extern
UART_HandleTypeDef
huart1
;
extern
UART_HandleTypeDef
huart2
;
/* USER CODE BEGIN EV */
/* USER CODE END EV */
...
...
@@ -226,6 +227,20 @@ void USART1_IRQHandler(void)
/* USER CODE END USART1_IRQn 1 */
}
/**
* @brief This function handles USART2 global interrupt.
*/
void
USART2_IRQHandler
(
void
)
{
/* USER CODE BEGIN USART2_IRQn 0 */
/* USER CODE END USART2_IRQn 0 */
HAL_UART_IRQHandler
(
&
huart2
);
/* USER CODE BEGIN USART2_IRQn 1 */
/* USER CODE END USART2_IRQn 1 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
...
...
bsp/stm32/stm32h743-atk-apollo/board/Kconfig
浏览文件 @
7cf7841c
...
...
@@ -8,7 +8,15 @@ config SOC_STM32H743II
default y
menu "Onboard Peripheral Drivers"
config BSP_USING_COM2
bool "Enable COM2(485)"
select BSP_USING_UART
select BSP_USING_UART2
select BSP_USING_I2C1
select PKG_USING_PCF8574
default n
config BSP_USING_SDRAM
bool "Enable SDRAM"
select BSP_USING_FMC
...
...
@@ -44,6 +52,10 @@ menu "On-chip Peripheral Drivers"
config BSP_USING_UART1
bool "Enable UART1"
default y
config BSP_USING_UART2
bool "Enable UART2"
default n
endif
config BSP_USING_FMC
...
...
@@ -70,6 +82,24 @@ menu "On-chip Peripheral Drivers"
select RT_USING_SPI
default n
menuconfig BSP_USING_I2C1
bool "Enable I2C1 BUS (software simulation)"
default n
select RT_USING_I2C
select RT_USING_I2C_BITOPS
select RT_USING_PIN
if BSP_USING_I2C1
comment "Notice: PH4 --> 116; PH5 --> 117"
config BSP_I2C1_SCL_PIN
int "i2c1 scl pin number"
range 1 176
default 116
config BSP_I2C1_SDA_PIN
int "I2C1 sda pin number"
range 1 176
default 117
endif
menuconfig BSP_USING_ONCHIP_RTC
bool "Enable RTC"
select RT_USING_RTC
...
...
bsp/stm32/stm32h743-atk-apollo/board/board.c
浏览文件 @
7cf7841c
...
...
@@ -70,8 +70,9 @@ void SystemClock_Config(void)
Error_Handler
();
}
PeriphClkInitStruct
.
PeriphClockSelection
=
RCC_PERIPHCLK_RTC
|
RCC_PERIPHCLK_LTDC
|
RCC_PERIPHCLK_USART1
|
RCC_PERIPHCLK_SPI2
|
RCC_PERIPHCLK_QSPI
|
RCC_PERIPHCLK_FMC
;
|
RCC_PERIPHCLK_USART2
|
RCC_PERIPHCLK_USART1
|
RCC_PERIPHCLK_SPI2
|
RCC_PERIPHCLK_QSPI
|
RCC_PERIPHCLK_FMC
;
PeriphClkInitStruct
.
PLL3
.
PLL3M
=
5
;
PeriphClkInitStruct
.
PLL3
.
PLL3N
=
160
;
PeriphClkInitStruct
.
PLL3
.
PLL3P
=
2
;
...
...
@@ -83,6 +84,7 @@ void SystemClock_Config(void)
PeriphClkInitStruct
.
FmcClockSelection
=
RCC_FMCCLKSOURCE_D1HCLK
;
PeriphClkInitStruct
.
QspiClockSelection
=
RCC_QSPICLKSOURCE_D1HCLK
;
PeriphClkInitStruct
.
Spi123ClockSelection
=
RCC_SPI123CLKSOURCE_PLL
;
PeriphClkInitStruct
.
Usart234578ClockSelection
=
RCC_USART234578CLKSOURCE_D2PCLK1
;
PeriphClkInitStruct
.
Usart16ClockSelection
=
RCC_USART16CLKSOURCE_D2PCLK2
;
PeriphClkInitStruct
.
RTCClockSelection
=
RCC_RTCCLKSOURCE_LSE
;
if
(
HAL_RCCEx_PeriphCLKConfig
(
&
PeriphClkInitStruct
)
!=
HAL_OK
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录