Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
AdRainty
rt-thread
提交
3bdfa40f
R
rt-thread
项目概览
AdRainty
/
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,发现更多精彩内容 >>
未验证
提交
3bdfa40f
编写于
4月 03, 2019
作者:
B
Bernard Xiong
提交者:
GitHub
4月 03, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2536 from Guozhanxin/f411
[stm32] F411-Nucleo 添加 uart6 的支持
上级
2f7abc50
291597de
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
215 addition
and
60 deletion
+215
-60
bsp/stm32/libraries/HAL_Drivers/config/f4/dma_config.h
bsp/stm32/libraries/HAL_Drivers/config/f4/dma_config.h
+6
-0
bsp/stm32/libraries/HAL_Drivers/config/f4/uart_config.h
bsp/stm32/libraries/HAL_Drivers/config/f4/uart_config.h
+43
-20
bsp/stm32/libraries/HAL_Drivers/drv_usart.c
bsp/stm32/libraries/HAL_Drivers/drv_usart.c
+36
-0
bsp/stm32/stm32f411-st-nucleo/.config
bsp/stm32/stm32f411-st-nucleo/.config
+17
-6
bsp/stm32/stm32f411-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc
...stm32f411-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc
+23
-17
bsp/stm32/stm32f411-st-nucleo/board/CubeMX_Config/Inc/main.h
bsp/stm32/stm32f411-st-nucleo/board/CubeMX_Config/Inc/main.h
+0
-2
bsp/stm32/stm32f411-st-nucleo/board/CubeMX_Config/Src/main.c
bsp/stm32/stm32f411-st-nucleo/board/CubeMX_Config/Src/main.c
+36
-10
bsp/stm32/stm32f411-st-nucleo/board/CubeMX_Config/Src/stm32f4xx_hal_msp.c
...411-st-nucleo/board/CubeMX_Config/Src/stm32f4xx_hal_msp.c
+42
-0
bsp/stm32/stm32f411-st-nucleo/board/Kconfig
bsp/stm32/stm32f411-st-nucleo/board/Kconfig
+12
-2
bsp/stm32/stm32f411-st-nucleo/rtconfig.h
bsp/stm32/stm32f411-st-nucleo/rtconfig.h
+0
-3
未找到文件。
bsp/stm32/libraries/HAL_Drivers/config/f4/dma_config.h
浏览文件 @
3bdfa40f
...
...
@@ -123,6 +123,12 @@ extern "C" {
#define SPI4_TX_DMA_INSTANCE DMA2_Stream1
#define SPI4_TX_DMA_CHANNEL DMA_CHANNEL_4
#define SPI4_TX_DMA_IRQ DMA2_Stream1_IRQn
#elif defined(BSP_UART6_RX_USING_DMA) && !defined(UART6_RX_DMA_INSTANCE)
#define UART6_DMA_RX_IRQHandler DMA2_Stream1_IRQHandler
#define UART6_RX_DMA_RCC RCC_AHB1ENR_DMA2EN
#define UART6_RX_DMA_INSTANCE DMA2_Stream1
#define UART6_RX_DMA_CHANNEL DMA_CHANNEL_5
#define UART6_RX_DMA_IRQ DMA2_Stream1_IRQn
#endif
/* DMA2 stream2 */
...
...
bsp/stm32/libraries/HAL_Drivers/config/f4/uart_config.h
浏览文件 @
3bdfa40f
...
...
@@ -33,10 +33,10 @@ extern "C" {
#ifndef UART1_DMA_CONFIG
#define UART1_DMA_CONFIG \
{ \
.Instance = UART1_RX_DMA_INSTANCE, \
.channel = UART1_RX_DMA_CHANNEL, \
.dma_rcc = UART1_RX_DMA_RCC, \
.dma_irq = UART1_RX_DMA_IRQ, \
.Instance = UART1_RX_DMA_INSTANCE,
\
.channel = UART1_RX_DMA_CHANNEL,
\
.dma_rcc = UART1_RX_DMA_RCC,
\
.dma_irq = UART1_RX_DMA_IRQ,
\
}
#endif
/* UART1_DMA_CONFIG */
#endif
/* BSP_UART1_RX_USING_DMA */
...
...
@@ -56,10 +56,10 @@ extern "C" {
#ifndef UART2_DMA_CONFIG
#define UART2_DMA_CONFIG \
{ \
.Instance = UART2_RX_DMA_INSTANCE, \
.channel = UART2_RX_DMA_CHANNEL, \
.dma_rcc = UART2_RX_DMA_RCC, \
.dma_irq = UART2_RX_DMA_IRQ, \
.Instance = UART2_RX_DMA_INSTANCE,
\
.channel = UART2_RX_DMA_CHANNEL,
\
.dma_rcc = UART2_RX_DMA_RCC,
\
.dma_irq = UART2_RX_DMA_IRQ,
\
}
#endif
/* UART2_DMA_CONFIG */
#endif
/* BSP_UART2_RX_USING_DMA */
...
...
@@ -79,10 +79,10 @@ extern "C" {
#ifndef UART3_DMA_CONFIG
#define UART3_DMA_CONFIG \
{ \
.Instance = UART3_RX_DMA_INSTANCE, \
.channel = UART3_RX_DMA_CHANNEL, \
.dma_rcc = UART3_RX_DMA_RCC, \
.dma_irq = UART3_RX_DMA_IRQ, \
.Instance = UART3_RX_DMA_INSTANCE,
\
.channel = UART3_RX_DMA_CHANNEL,
\
.dma_rcc = UART3_RX_DMA_RCC,
\
.dma_irq = UART3_RX_DMA_IRQ,
\
}
#endif
/* UART3_DMA_CONFIG */
#endif
/* BSP_UART3_RX_USING_DMA */
...
...
@@ -102,10 +102,10 @@ extern "C" {
#ifndef UART4_DMA_CONFIG
#define UART4_DMA_CONFIG \
{ \
.Instance = UART4_RX_DMA_INSTANCE, \
.channel = UART4_RX_DMA_CHANNEL, \
.dma_rcc = UART4_RX_DMA_RCC, \
.dma_irq = UART4_RX_DMA_IRQ, \
.Instance = UART4_RX_DMA_INSTANCE,
\
.channel = UART4_RX_DMA_CHANNEL,
\
.dma_rcc = UART4_RX_DMA_RCC,
\
.dma_irq = UART4_RX_DMA_IRQ,
\
}
#endif
/* UART4_DMA_CONFIG */
#endif
/* BSP_UART4_RX_USING_DMA */
...
...
@@ -125,14 +125,37 @@ extern "C" {
#ifndef UART5_DMA_CONFIG
#define UART5_DMA_CONFIG \
{ \
.Instance = UART5_RX_DMA_INSTANCE, \
.channel = UART5_RX_DMA_CHANNEL, \
.dma_rcc = UART5_RX_DMA_RCC, \
.dma_irq = UART5_RX_DMA_IRQ, \
.Instance = UART5_RX_DMA_INSTANCE,
\
.channel = UART5_RX_DMA_CHANNEL,
\
.dma_rcc = UART5_RX_DMA_RCC,
\
.dma_irq = UART5_RX_DMA_IRQ,
\
}
#endif
/* UART5_DMA_CONFIG */
#endif
/* BSP_UART5_RX_USING_DMA */
#if defined(BSP_USING_UART6)
#ifndef UART6_CONFIG
#define UART6_CONFIG \
{ \
.name = "uart6", \
.Instance = USART6, \
.irq_type = USART6_IRQn, \
}
#endif
/* UART6_CONFIG */
#endif
/* BSP_USING_UART6 */
#if defined(BSP_UART6_RX_USING_DMA)
#ifndef UART6_DMA_CONFIG
#define UART6_DMA_CONFIG \
{ \
.Instance = UART6_RX_DMA_INSTANCE, \
.channel = UART6_RX_DMA_CHANNEL, \
.dma_rcc = UART6_RX_DMA_RCC, \
.dma_irq = UART6_RX_DMA_IRQ, \
}
#endif
/* UART6_DMA_CONFIG */
#endif
/* BSP_UART6_RX_USING_DMA */
#ifdef __cplusplus
}
#endif
...
...
bsp/stm32/libraries/HAL_Drivers/drv_usart.c
浏览文件 @
3bdfa40f
...
...
@@ -45,6 +45,9 @@ enum
#ifdef BSP_USING_UART5
UART5_INDEX
,
#endif
#ifdef BSP_USING_UART6
UART6_INDEX
,
#endif
#ifdef BSP_USING_LPUART1
LPUART1_INDEX
,
#endif
...
...
@@ -67,6 +70,9 @@ static struct stm32_uart_config uart_config[] =
#ifdef BSP_USING_UART5
UART5_CONFIG
,
#endif
#ifdef BSP_USING_UART6
UART6_CONFIG
,
#endif
#ifdef BSP_USING_LPUART1
LPUART1_CONFIG
,
#endif
...
...
@@ -431,6 +437,31 @@ void UART5_DMA_RX_IRQHandler(void)
#endif
/* defined(RT_SERIAL_USING_DMA) && defined(BSP_UART5_RX_USING_DMA) */
#endif
/* BSP_USING_UART5*/
#if defined(BSP_USING_UART6)
void
USART6_IRQHandler
(
void
)
{
/* enter interrupt */
rt_interrupt_enter
();
uart_isr
(
&
(
uart_obj
[
UART6_INDEX
].
serial
));
/* leave interrupt */
rt_interrupt_leave
();
}
#if defined(RT_SERIAL_USING_DMA) && defined(BSP_UART6_RX_USING_DMA)
void
UART6_DMA_RX_IRQHandler
(
void
)
{
/* enter interrupt */
rt_interrupt_enter
();
HAL_DMA_IRQHandler
(
&
uart_obj
[
UART6_INDEX
].
dma
.
handle
);
/* leave interrupt */
rt_interrupt_leave
();
}
#endif
/* defined(RT_SERIAL_USING_DMA) && defined(BSP_UART6_RX_USING_DMA) */
#endif
/* BSP_USING_UART6*/
#if defined(BSP_USING_LPUART1)
void
LPUART1_IRQHandler
(
void
)
{
...
...
@@ -608,6 +639,11 @@ static void stm32_uart_get_dma_config(void)
static
struct
dma_config
uart5_dma_rx
=
UART5_DMA_CONFIG
;
uart_config
[
UART5_INDEX
].
dma_rx
=
&
uart5_dma_rx
;
#endif
#ifdef BSP_UART6_RX_USING_DMA
uart_obj
[
UART6_INDEX
].
uart_dma_flag
=
1
;
static
struct
dma_config
uart6_dma_rx
=
UART6_DMA_CONFIG
;
uart_config
[
UART6_INDEX
].
dma_rx
=
&
uart6_dma_rx
;
#endif
#ifdef BSP_LPUART1_RX_USING_DMA
uart_obj
[
LPUART1_INDEX
].
uart_dma_flag
=
1
;
static
struct
dma_config
lpuart1_dma_rx
=
LPUART1_DMA_CONFIG
;
...
...
bsp/stm32/stm32f411-st-nucleo/.config
浏览文件 @
3bdfa40f
...
...
@@ -7,6 +7,7 @@
# RT-Thread Kernel
#
CONFIG_RT_NAME_MAX
=
8
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
# CONFIG_RT_USING_SMP is not set
CONFIG_RT_ALIGN_SIZE
=
4
# CONFIG_RT_THREAD_PRIORITY_8 is not set
...
...
@@ -111,6 +112,7 @@ CONFIG_FINSH_ARG_MAX=10
#
CONFIG_RT_USING_DEVICE_IPC
=
y
CONFIG_RT_PIPE_BUFSZ
=
512
# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
CONFIG_RT_USING_SERIAL
=
y
# CONFIG_RT_SERIAL_USING_DMA is not set
CONFIG_RT_SERIAL_RB_BUFSZ
=
64
...
...
@@ -185,12 +187,6 @@ CONFIG_RT_USING_PIN=y
# CONFIG_RT_USING_RYM is not set
# CONFIG_RT_USING_ULOG is not set
# CONFIG_RT_USING_UTEST is not set
#
# ARM CMSIS
#
# CONFIG_RT_USING_CMSIS_OS is not set
# CONFIG_RT_USING_RTT_CMSIS is not set
# CONFIG_RT_USING_LWP is not set
#
...
...
@@ -207,6 +203,7 @@ CONFIG_RT_USING_PIN=y
# CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_LIBMODBUS is not set
# CONFIG_PKG_USING_LJSON is not set
# CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
...
...
@@ -224,6 +221,7 @@ CONFIG_RT_USING_PIN=y
# Wiced WiFi
#
# CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_RW007 is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
# CONFIG_PKG_USING_NETUTILS is not set
...
...
@@ -238,6 +236,8 @@ CONFIG_RT_USING_PIN=y
# CONFIG_PKG_USING_ALI_IOTKIT is not set
# CONFIG_PKG_USING_AZURE is not set
# CONFIG_PKG_USING_TENCENT_IOTKIT is not set
# CONFIG_PKG_USING_NIMBLE is not set
# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
#
# security packages
...
...
@@ -258,6 +258,7 @@ CONFIG_RT_USING_PIN=y
#
# CONFIG_PKG_USING_OPENMV is not set
# CONFIG_PKG_USING_MUPDF is not set
# CONFIG_PKG_USING_STEMWIN is not set
#
# tools packages
...
...
@@ -269,6 +270,7 @@ CONFIG_RT_USING_PIN=y
# CONFIG_PKG_USING_RDB is not set
# CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
# CONFIG_PKG_USING_ADBD is not set
#
# system packages
...
...
@@ -286,10 +288,12 @@ CONFIG_RT_USING_PIN=y
# CONFIG_PKG_USING_CMSIS is not set
# CONFIG_PKG_USING_DFS_YAFFS is not set
# CONFIG_PKG_USING_LITTLEFS is not set
# CONFIG_PKG_USING_THREAD_POOL is not set
#
# peripheral libraries and drivers
#
# CONFIG_PKG_USING_SENSORS_DRIVERS is not set
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_SHT2X is not set
# CONFIG_PKG_USING_AHT10 is not set
...
...
@@ -300,7 +304,11 @@ CONFIG_RT_USING_PIN=y
# CONFIG_PKG_USING_BUTTON is not set
# CONFIG_PKG_USING_MPU6XXX is not set
# CONFIG_PKG_USING_PCF8574 is not set
# CONFIG_PKG_USING_SX12XX is not set
# CONFIG_PKG_USING_SIGNAL_LED is not set
# CONFIG_PKG_USING_WM_LIBRARIES is not set
# CONFIG_PKG_USING_KENDRYTE_SDK is not set
# CONFIG_PKG_USING_INFRARED is not set
#
# miscellaneous packages
...
...
@@ -326,6 +334,8 @@ CONFIG_RT_USING_PIN=y
# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
# CONFIG_PKG_USING_HELLO is not set
# CONFIG_PKG_USING_VI is not set
# CONFIG_PKG_USING_NNOM is not set
CONFIG_SOC_FAMILY_STM32
=
y
CONFIG_SOC_SERIES_STM32F4
=
y
...
...
@@ -344,6 +354,7 @@ CONFIG_SOC_STM32F411RE=y
CONFIG_BSP_USING_GPIO
=
y
CONFIG_BSP_USING_UART
=
y
CONFIG_BSP_USING_UART2
=
y
# CONFIG_BSP_USING_UART6 is not set
# CONFIG_BSP_USING_I2C1 is not set
# CONFIG_BSP_USING_PWM is not set
# CONFIG_BSP_USING_ON_CHIP_FLASH is not set
...
...
bsp/stm32/stm32f411-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc
浏览文件 @
3bdfa40f
...
...
@@ -7,27 +7,29 @@ Mcu.IP1=RCC
Mcu.IP2=SYS
Mcu.IP3=TIM3
Mcu.IP4=USART2
Mcu.IPNb=5
Mcu.IP5=USART6
Mcu.IPNb=6
Mcu.Name=STM32F411R(C-E)Tx
Mcu.Package=LQFP64
Mcu.Pin0=PC13-ANTI_TAMP
Mcu.Pin1=PC14-OSC32_IN
Mcu.Pin10=PB0
Mcu.Pin11=PB1
Mcu.Pin12=PA13
Mcu.Pin13=PA14
Mcu.Pin14=PB3
Mcu.Pin15=VP_SYS_VS_Systick
Mcu.Pin16=VP_TIM3_VS_ClockSourceINT
Mcu.Pin10=PB1
Mcu.Pin11=PA11
Mcu.Pin12=PA12
Mcu.Pin13=PA13
Mcu.Pin14=PA14
Mcu.Pin15=PB3
Mcu.Pin16=VP_SYS_VS_Systick
Mcu.Pin17=VP_TIM3_VS_ClockSourceINT
Mcu.Pin2=PC15-OSC32_OUT
Mcu.Pin3=PH0 - OSC_IN
Mcu.Pin4=PH1 - OSC_OUT
Mcu.Pin5=PA2
Mcu.Pin6=PA3
Mcu.Pin7=PA
5
Mcu.Pin8=PA
6
Mcu.Pin9=P
A7
Mcu.PinsNb=1
7
Mcu.Pin7=PA
6
Mcu.Pin8=PA
7
Mcu.Pin9=P
B0
Mcu.PinsNb=1
8
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F411RETx
...
...
@@ -43,6 +45,12 @@ NVIC.PriorityGroup=NVIC_PRIORITYGROUP_0
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.SysTick_IRQn=true\:0\:0\:true\:false\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:true
PA11.Locked=true
PA11.Mode=Asynchronous
PA11.Signal=USART6_TX
PA12.Locked=true
PA12.Mode=Asynchronous
PA12.Signal=USART6_RX
PA13.GPIOParameters=GPIO_Label
PA13.GPIO_Label=TMS
PA13.Locked=true
...
...
@@ -57,10 +65,6 @@ PA2.Mode=Asynchronous
PA2.Signal=USART2_TX
PA3.Mode=Asynchronous
PA3.Signal=USART2_RX
PA5.GPIOParameters=GPIO_Label
PA5.GPIO_Label=LD2 [Green Led]
PA5.Locked=true
PA5.Signal=GPIO_Output
PA6.Signal=S_TIM3_CH1
PA7.Signal=S_TIM3_CH2
PB0.Signal=S_TIM3_CH3
...
...
@@ -121,7 +125,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_USART2_UART_Init-USART2-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true
,5-MX_USART6_UART_Init-USART6-false-HAL-true
RCC.48MHZClocksFreq_Value=42000000
RCC.AHBFreq_Value=84000000
RCC.APB1CLKDivider=RCC_HCLK_DIV2
...
...
@@ -172,6 +176,8 @@ TIM3.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
TIM3.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2,Channel-PWM Generation3 CH3,Channel-PWM Generation4 CH4
USART2.IPParameters=VirtualMode
USART2.VirtualMode=VM_ASYNC
USART6.IPParameters=VirtualMode
USART6.VirtualMode=VM_ASYNC
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
VP_TIM3_VS_ClockSourceINT.Mode=Internal
...
...
bsp/stm32/stm32f411-st-nucleo/board/CubeMX_Config/Inc/main.h
浏览文件 @
3bdfa40f
...
...
@@ -82,8 +82,6 @@ void Error_Handler(void);
/* Private defines -----------------------------------------------------------*/
#define B1_Pin GPIO_PIN_13
#define B1_GPIO_Port GPIOC
#define LD2_Pin GPIO_PIN_5
#define LD2_GPIO_Port GPIOA
#define TMS_Pin GPIO_PIN_13
#define TMS_GPIO_Port GPIOA
#define TCK_Pin GPIO_PIN_14
...
...
bsp/stm32/stm32f411-st-nucleo/board/CubeMX_Config/Src/main.c
浏览文件 @
3bdfa40f
...
...
@@ -65,6 +65,7 @@
TIM_HandleTypeDef
htim3
;
UART_HandleTypeDef
huart2
;
UART_HandleTypeDef
huart6
;
/* USER CODE BEGIN PV */
...
...
@@ -75,6 +76,7 @@ void SystemClock_Config(void);
static
void
MX_GPIO_Init
(
void
);
static
void
MX_USART2_UART_Init
(
void
);
static
void
MX_TIM3_Init
(
void
);
static
void
MX_USART6_UART_Init
(
void
);
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
...
...
@@ -114,6 +116,7 @@ int main(void)
MX_GPIO_Init
();
MX_USART2_UART_Init
();
MX_TIM3_Init
();
MX_USART6_UART_Init
();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
...
...
@@ -274,6 +277,39 @@ static void MX_USART2_UART_Init(void)
}
/**
* @brief USART6 Initialization Function
* @param None
* @retval None
*/
static
void
MX_USART6_UART_Init
(
void
)
{
/* USER CODE BEGIN USART6_Init 0 */
/* USER CODE END USART6_Init 0 */
/* USER CODE BEGIN USART6_Init 1 */
/* USER CODE END USART6_Init 1 */
huart6
.
Instance
=
USART6
;
huart6
.
Init
.
BaudRate
=
115200
;
huart6
.
Init
.
WordLength
=
UART_WORDLENGTH_8B
;
huart6
.
Init
.
StopBits
=
UART_STOPBITS_1
;
huart6
.
Init
.
Parity
=
UART_PARITY_NONE
;
huart6
.
Init
.
Mode
=
UART_MODE_TX_RX
;
huart6
.
Init
.
HwFlowCtl
=
UART_HWCONTROL_NONE
;
huart6
.
Init
.
OverSampling
=
UART_OVERSAMPLING_16
;
if
(
HAL_UART_Init
(
&
huart6
)
!=
HAL_OK
)
{
Error_Handler
();
}
/* USER CODE BEGIN USART6_Init 2 */
/* USER CODE END USART6_Init 2 */
}
/**
* @brief GPIO Initialization Function
* @param None
...
...
@@ -289,22 +325,12 @@ static void MX_GPIO_Init(void)
__HAL_RCC_GPIOA_CLK_ENABLE
();
__HAL_RCC_GPIOB_CLK_ENABLE
();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin
(
LD2_GPIO_Port
,
LD2_Pin
,
GPIO_PIN_RESET
);
/*Configure GPIO pin : B1_Pin */
GPIO_InitStruct
.
Pin
=
B1_Pin
;
GPIO_InitStruct
.
Mode
=
GPIO_MODE_IT_FALLING
;
GPIO_InitStruct
.
Pull
=
GPIO_NOPULL
;
HAL_GPIO_Init
(
B1_GPIO_Port
,
&
GPIO_InitStruct
);
/*Configure GPIO pin : LD2_Pin */
GPIO_InitStruct
.
Pin
=
LD2_Pin
;
GPIO_InitStruct
.
Mode
=
GPIO_MODE_OUTPUT_PP
;
GPIO_InitStruct
.
Pull
=
GPIO_NOPULL
;
GPIO_InitStruct
.
Speed
=
GPIO_SPEED_FREQ_LOW
;
HAL_GPIO_Init
(
LD2_GPIO_Port
,
&
GPIO_InitStruct
);
}
/* USER CODE BEGIN 4 */
...
...
bsp/stm32/stm32f411-st-nucleo/board/CubeMX_Config/Src/stm32f4xx_hal_msp.c
浏览文件 @
3bdfa40f
...
...
@@ -220,6 +220,30 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
/* USER CODE END USART2_MspInit 1 */
}
else
if
(
huart
->
Instance
==
USART6
)
{
/* USER CODE BEGIN USART6_MspInit 0 */
/* USER CODE END USART6_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_USART6_CLK_ENABLE
();
__HAL_RCC_GPIOA_CLK_ENABLE
();
/**USART6 GPIO Configuration
PA11 ------> USART6_TX
PA12 ------> USART6_RX
*/
GPIO_InitStruct
.
Pin
=
GPIO_PIN_11
|
GPIO_PIN_12
;
GPIO_InitStruct
.
Mode
=
GPIO_MODE_AF_PP
;
GPIO_InitStruct
.
Pull
=
GPIO_PULLUP
;
GPIO_InitStruct
.
Speed
=
GPIO_SPEED_FREQ_VERY_HIGH
;
GPIO_InitStruct
.
Alternate
=
GPIO_AF8_USART6
;
HAL_GPIO_Init
(
GPIOA
,
&
GPIO_InitStruct
);
/* USER CODE BEGIN USART6_MspInit 1 */
/* USER CODE END USART6_MspInit 1 */
}
}
...
...
@@ -251,6 +275,24 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
/* USER CODE END USART2_MspDeInit 1 */
}
else
if
(
huart
->
Instance
==
USART6
)
{
/* USER CODE BEGIN USART6_MspDeInit 0 */
/* USER CODE END USART6_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_USART6_CLK_DISABLE
();
/**USART6 GPIO Configuration
PA11 ------> USART6_TX
PA12 ------> USART6_RX
*/
HAL_GPIO_DeInit
(
GPIOA
,
GPIO_PIN_11
|
GPIO_PIN_12
);
/* USER CODE BEGIN USART6_MspDeInit 1 */
/* USER CODE END USART6_MspDeInit 1 */
}
}
...
...
bsp/stm32/stm32f411-st-nucleo/board/Kconfig
浏览文件 @
3bdfa40f
...
...
@@ -29,6 +29,15 @@ menu "On-chip Peripheral Drivers"
bool "Enable UART2 RX DMA"
depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA
default n
config BSP_USING_UART6
bool "Enable UART6"
default y
config BSP_UART6_RX_USING_DMA
bool "Enable UART6 RX DMA"
depends on BSP_USING_UART6 && RT_SERIAL_USING_DMA
default n
endif
menuconfig BSP_USING_I2C1
...
...
@@ -38,14 +47,15 @@ menu "On-chip Peripheral Drivers"
select RT_USING_I2C_BITOPS
select RT_USING_PIN
if BSP_USING_I2C1
comment "Notice: PB8 --> 24; PB9 --> 25"
config BSP_I2C1_SCL_PIN
int "i2c1 scl pin number"
range 0 80
default
30
default
24
config BSP_I2C1_SDA_PIN
int "I2C1 sda pin number"
range 0 80
default
31
default
25
endif
menuconfig BSP_USING_PWM
...
...
bsp/stm32/stm32f411-st-nucleo/rtconfig.h
浏览文件 @
3bdfa40f
...
...
@@ -110,9 +110,6 @@
/* Utilities */
/* ARM CMSIS */
/* RT-Thread online packages */
/* IoT - internet of things */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录