Merge pull request #2536 from Guozhanxin/f411

[stm32] F411-Nucleo 添加 uart6 的支持
This commit is contained in:
Bernard Xiong 2019-04-03 08:33:53 +08:00 committed by GitHub
commit 3bdfa40f77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 215 additions and 60 deletions

View File

@ -123,6 +123,12 @@ extern "C" {
#define SPI4_TX_DMA_INSTANCE DMA2_Stream1 #define SPI4_TX_DMA_INSTANCE DMA2_Stream1
#define SPI4_TX_DMA_CHANNEL DMA_CHANNEL_4 #define SPI4_TX_DMA_CHANNEL DMA_CHANNEL_4
#define SPI4_TX_DMA_IRQ DMA2_Stream1_IRQn #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 #endif
/* DMA2 stream2 */ /* DMA2 stream2 */

View File

@ -33,10 +33,10 @@ extern "C" {
#ifndef UART1_DMA_CONFIG #ifndef UART1_DMA_CONFIG
#define UART1_DMA_CONFIG \ #define UART1_DMA_CONFIG \
{ \ { \
.Instance = UART1_RX_DMA_INSTANCE, \ .Instance = UART1_RX_DMA_INSTANCE, \
.channel = UART1_RX_DMA_CHANNEL, \ .channel = UART1_RX_DMA_CHANNEL, \
.dma_rcc = UART1_RX_DMA_RCC, \ .dma_rcc = UART1_RX_DMA_RCC, \
.dma_irq = UART1_RX_DMA_IRQ, \ .dma_irq = UART1_RX_DMA_IRQ, \
} }
#endif /* UART1_DMA_CONFIG */ #endif /* UART1_DMA_CONFIG */
#endif /* BSP_UART1_RX_USING_DMA */ #endif /* BSP_UART1_RX_USING_DMA */
@ -56,10 +56,10 @@ extern "C" {
#ifndef UART2_DMA_CONFIG #ifndef UART2_DMA_CONFIG
#define UART2_DMA_CONFIG \ #define UART2_DMA_CONFIG \
{ \ { \
.Instance = UART2_RX_DMA_INSTANCE, \ .Instance = UART2_RX_DMA_INSTANCE, \
.channel = UART2_RX_DMA_CHANNEL, \ .channel = UART2_RX_DMA_CHANNEL, \
.dma_rcc = UART2_RX_DMA_RCC, \ .dma_rcc = UART2_RX_DMA_RCC, \
.dma_irq = UART2_RX_DMA_IRQ, \ .dma_irq = UART2_RX_DMA_IRQ, \
} }
#endif /* UART2_DMA_CONFIG */ #endif /* UART2_DMA_CONFIG */
#endif /* BSP_UART2_RX_USING_DMA */ #endif /* BSP_UART2_RX_USING_DMA */
@ -79,10 +79,10 @@ extern "C" {
#ifndef UART3_DMA_CONFIG #ifndef UART3_DMA_CONFIG
#define UART3_DMA_CONFIG \ #define UART3_DMA_CONFIG \
{ \ { \
.Instance = UART3_RX_DMA_INSTANCE, \ .Instance = UART3_RX_DMA_INSTANCE, \
.channel = UART3_RX_DMA_CHANNEL, \ .channel = UART3_RX_DMA_CHANNEL, \
.dma_rcc = UART3_RX_DMA_RCC, \ .dma_rcc = UART3_RX_DMA_RCC, \
.dma_irq = UART3_RX_DMA_IRQ, \ .dma_irq = UART3_RX_DMA_IRQ, \
} }
#endif /* UART3_DMA_CONFIG */ #endif /* UART3_DMA_CONFIG */
#endif /* BSP_UART3_RX_USING_DMA */ #endif /* BSP_UART3_RX_USING_DMA */
@ -102,10 +102,10 @@ extern "C" {
#ifndef UART4_DMA_CONFIG #ifndef UART4_DMA_CONFIG
#define UART4_DMA_CONFIG \ #define UART4_DMA_CONFIG \
{ \ { \
.Instance = UART4_RX_DMA_INSTANCE, \ .Instance = UART4_RX_DMA_INSTANCE, \
.channel = UART4_RX_DMA_CHANNEL, \ .channel = UART4_RX_DMA_CHANNEL, \
.dma_rcc = UART4_RX_DMA_RCC, \ .dma_rcc = UART4_RX_DMA_RCC, \
.dma_irq = UART4_RX_DMA_IRQ, \ .dma_irq = UART4_RX_DMA_IRQ, \
} }
#endif /* UART4_DMA_CONFIG */ #endif /* UART4_DMA_CONFIG */
#endif /* BSP_UART4_RX_USING_DMA */ #endif /* BSP_UART4_RX_USING_DMA */
@ -125,14 +125,37 @@ extern "C" {
#ifndef UART5_DMA_CONFIG #ifndef UART5_DMA_CONFIG
#define UART5_DMA_CONFIG \ #define UART5_DMA_CONFIG \
{ \ { \
.Instance = UART5_RX_DMA_INSTANCE, \ .Instance = UART5_RX_DMA_INSTANCE, \
.channel = UART5_RX_DMA_CHANNEL, \ .channel = UART5_RX_DMA_CHANNEL, \
.dma_rcc = UART5_RX_DMA_RCC, \ .dma_rcc = UART5_RX_DMA_RCC, \
.dma_irq = UART5_RX_DMA_IRQ, \ .dma_irq = UART5_RX_DMA_IRQ, \
} }
#endif /* UART5_DMA_CONFIG */ #endif /* UART5_DMA_CONFIG */
#endif /* BSP_UART5_RX_USING_DMA */ #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 #ifdef __cplusplus
} }
#endif #endif

View File

@ -45,6 +45,9 @@ enum
#ifdef BSP_USING_UART5 #ifdef BSP_USING_UART5
UART5_INDEX, UART5_INDEX,
#endif #endif
#ifdef BSP_USING_UART6
UART6_INDEX,
#endif
#ifdef BSP_USING_LPUART1 #ifdef BSP_USING_LPUART1
LPUART1_INDEX, LPUART1_INDEX,
#endif #endif
@ -67,6 +70,9 @@ static struct stm32_uart_config uart_config[] =
#ifdef BSP_USING_UART5 #ifdef BSP_USING_UART5
UART5_CONFIG, UART5_CONFIG,
#endif #endif
#ifdef BSP_USING_UART6
UART6_CONFIG,
#endif
#ifdef BSP_USING_LPUART1 #ifdef BSP_USING_LPUART1
LPUART1_CONFIG, LPUART1_CONFIG,
#endif #endif
@ -431,6 +437,31 @@ void UART5_DMA_RX_IRQHandler(void)
#endif /* defined(RT_SERIAL_USING_DMA) && defined(BSP_UART5_RX_USING_DMA) */ #endif /* defined(RT_SERIAL_USING_DMA) && defined(BSP_UART5_RX_USING_DMA) */
#endif /* BSP_USING_UART5*/ #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) #if defined(BSP_USING_LPUART1)
void LPUART1_IRQHandler(void) 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; static struct dma_config uart5_dma_rx = UART5_DMA_CONFIG;
uart_config[UART5_INDEX].dma_rx = &uart5_dma_rx; uart_config[UART5_INDEX].dma_rx = &uart5_dma_rx;
#endif #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 #ifdef BSP_LPUART1_RX_USING_DMA
uart_obj[LPUART1_INDEX].uart_dma_flag = 1; uart_obj[LPUART1_INDEX].uart_dma_flag = 1;
static struct dma_config lpuart1_dma_rx = LPUART1_DMA_CONFIG; static struct dma_config lpuart1_dma_rx = LPUART1_DMA_CONFIG;

View File

@ -7,6 +7,7 @@
# RT-Thread Kernel # RT-Thread Kernel
# #
CONFIG_RT_NAME_MAX=8 CONFIG_RT_NAME_MAX=8
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
# CONFIG_RT_USING_SMP is not set # CONFIG_RT_USING_SMP is not set
CONFIG_RT_ALIGN_SIZE=4 CONFIG_RT_ALIGN_SIZE=4
# CONFIG_RT_THREAD_PRIORITY_8 is not set # 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_USING_DEVICE_IPC=y
CONFIG_RT_PIPE_BUFSZ=512 CONFIG_RT_PIPE_BUFSZ=512
# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
CONFIG_RT_USING_SERIAL=y CONFIG_RT_USING_SERIAL=y
# CONFIG_RT_SERIAL_USING_DMA is not set # CONFIG_RT_SERIAL_USING_DMA is not set
CONFIG_RT_SERIAL_RB_BUFSZ=64 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_RYM is not set
# CONFIG_RT_USING_ULOG is not set # CONFIG_RT_USING_ULOG is not set
# CONFIG_RT_USING_UTEST 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 # 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_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set # CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_JSMN 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_LJSON is not set
# CONFIG_PKG_USING_EZXML is not set # CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set # CONFIG_PKG_USING_NANOPB is not set
@ -224,6 +221,7 @@ CONFIG_RT_USING_PIN=y
# Wiced WiFi # Wiced WiFi
# #
# CONFIG_PKG_USING_WLAN_WICED is not set # 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_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set # CONFIG_PKG_USING_NOPOLL is not set
# CONFIG_PKG_USING_NETUTILS 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_ALI_IOTKIT is not set
# CONFIG_PKG_USING_AZURE is not set # CONFIG_PKG_USING_AZURE is not set
# CONFIG_PKG_USING_TENCENT_IOTKIT 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 # security packages
@ -258,6 +258,7 @@ CONFIG_RT_USING_PIN=y
# #
# CONFIG_PKG_USING_OPENMV is not set # CONFIG_PKG_USING_OPENMV is not set
# CONFIG_PKG_USING_MUPDF is not set # CONFIG_PKG_USING_MUPDF is not set
# CONFIG_PKG_USING_STEMWIN is not set
# #
# tools packages # tools packages
@ -269,6 +270,7 @@ CONFIG_RT_USING_PIN=y
# CONFIG_PKG_USING_RDB is not set # CONFIG_PKG_USING_RDB is not set
# CONFIG_PKG_USING_QRCODE is not set # CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set # CONFIG_PKG_USING_ULOG_EASYFLASH is not set
# CONFIG_PKG_USING_ADBD is not set
# #
# system packages # system packages
@ -286,10 +288,12 @@ CONFIG_RT_USING_PIN=y
# CONFIG_PKG_USING_CMSIS is not set # CONFIG_PKG_USING_CMSIS is not set
# CONFIG_PKG_USING_DFS_YAFFS is not set # CONFIG_PKG_USING_DFS_YAFFS is not set
# CONFIG_PKG_USING_LITTLEFS is not set # CONFIG_PKG_USING_LITTLEFS is not set
# CONFIG_PKG_USING_THREAD_POOL is not set
# #
# peripheral libraries and drivers # peripheral libraries and drivers
# #
# CONFIG_PKG_USING_SENSORS_DRIVERS is not set
# CONFIG_PKG_USING_REALTEK_AMEBA is not set # CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_SHT2X is not set # CONFIG_PKG_USING_SHT2X is not set
# CONFIG_PKG_USING_AHT10 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_BUTTON is not set
# CONFIG_PKG_USING_MPU6XXX is not set # CONFIG_PKG_USING_MPU6XXX is not set
# CONFIG_PKG_USING_PCF8574 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_KENDRYTE_SDK is not set
# CONFIG_PKG_USING_INFRARED is not set
# #
# miscellaneous packages # miscellaneous packages
@ -326,6 +334,8 @@ CONFIG_RT_USING_PIN=y
# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set # CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
# CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_HELLO is not set
# CONFIG_PKG_USING_VI is not set # CONFIG_PKG_USING_VI is not set
# CONFIG_PKG_USING_NNOM is not set
CONFIG_SOC_FAMILY_STM32=y CONFIG_SOC_FAMILY_STM32=y
CONFIG_SOC_SERIES_STM32F4=y CONFIG_SOC_SERIES_STM32F4=y
@ -344,6 +354,7 @@ CONFIG_SOC_STM32F411RE=y
CONFIG_BSP_USING_GPIO=y CONFIG_BSP_USING_GPIO=y
CONFIG_BSP_USING_UART=y CONFIG_BSP_USING_UART=y
CONFIG_BSP_USING_UART2=y CONFIG_BSP_USING_UART2=y
# CONFIG_BSP_USING_UART6 is not set
# CONFIG_BSP_USING_I2C1 is not set # CONFIG_BSP_USING_I2C1 is not set
# CONFIG_BSP_USING_PWM is not set # CONFIG_BSP_USING_PWM is not set
# CONFIG_BSP_USING_ON_CHIP_FLASH is not set # CONFIG_BSP_USING_ON_CHIP_FLASH is not set

View File

@ -7,27 +7,29 @@ Mcu.IP1=RCC
Mcu.IP2=SYS Mcu.IP2=SYS
Mcu.IP3=TIM3 Mcu.IP3=TIM3
Mcu.IP4=USART2 Mcu.IP4=USART2
Mcu.IPNb=5 Mcu.IP5=USART6
Mcu.IPNb=6
Mcu.Name=STM32F411R(C-E)Tx Mcu.Name=STM32F411R(C-E)Tx
Mcu.Package=LQFP64 Mcu.Package=LQFP64
Mcu.Pin0=PC13-ANTI_TAMP Mcu.Pin0=PC13-ANTI_TAMP
Mcu.Pin1=PC14-OSC32_IN Mcu.Pin1=PC14-OSC32_IN
Mcu.Pin10=PB0 Mcu.Pin10=PB1
Mcu.Pin11=PB1 Mcu.Pin11=PA11
Mcu.Pin12=PA13 Mcu.Pin12=PA12
Mcu.Pin13=PA14 Mcu.Pin13=PA13
Mcu.Pin14=PB3 Mcu.Pin14=PA14
Mcu.Pin15=VP_SYS_VS_Systick Mcu.Pin15=PB3
Mcu.Pin16=VP_TIM3_VS_ClockSourceINT Mcu.Pin16=VP_SYS_VS_Systick
Mcu.Pin17=VP_TIM3_VS_ClockSourceINT
Mcu.Pin2=PC15-OSC32_OUT Mcu.Pin2=PC15-OSC32_OUT
Mcu.Pin3=PH0 - OSC_IN Mcu.Pin3=PH0 - OSC_IN
Mcu.Pin4=PH1 - OSC_OUT Mcu.Pin4=PH1 - OSC_OUT
Mcu.Pin5=PA2 Mcu.Pin5=PA2
Mcu.Pin6=PA3 Mcu.Pin6=PA3
Mcu.Pin7=PA5 Mcu.Pin7=PA6
Mcu.Pin8=PA6 Mcu.Pin8=PA7
Mcu.Pin9=PA7 Mcu.Pin9=PB0
Mcu.PinsNb=17 Mcu.PinsNb=18
Mcu.ThirdPartyNb=0 Mcu.ThirdPartyNb=0
Mcu.UserConstants= Mcu.UserConstants=
Mcu.UserName=STM32F411RETx Mcu.UserName=STM32F411RETx
@ -43,6 +45,12 @@ NVIC.PriorityGroup=NVIC_PRIORITYGROUP_0
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false
NVIC.SysTick_IRQn=true\:0\:0\:true\:false\:true\:true NVIC.SysTick_IRQn=true\:0\:0\:true\:false\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\: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.GPIOParameters=GPIO_Label
PA13.GPIO_Label=TMS PA13.GPIO_Label=TMS
PA13.Locked=true PA13.Locked=true
@ -57,10 +65,6 @@ PA2.Mode=Asynchronous
PA2.Signal=USART2_TX PA2.Signal=USART2_TX
PA3.Mode=Asynchronous PA3.Mode=Asynchronous
PA3.Signal=USART2_RX 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 PA6.Signal=S_TIM3_CH1
PA7.Signal=S_TIM3_CH2 PA7.Signal=S_TIM3_CH2
PB0.Signal=S_TIM3_CH3 PB0.Signal=S_TIM3_CH3
@ -121,7 +125,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=MDK-ARM V5 ProjectManager.TargetToolchain=MDK-ARM V5
ProjectManager.ToolChainLocation= ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=false 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.48MHZClocksFreq_Value=42000000
RCC.AHBFreq_Value=84000000 RCC.AHBFreq_Value=84000000
RCC.APB1CLKDivider=RCC_HCLK_DIV2 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 TIM3.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2,Channel-PWM Generation3 CH3,Channel-PWM Generation4 CH4
USART2.IPParameters=VirtualMode USART2.IPParameters=VirtualMode
USART2.VirtualMode=VM_ASYNC USART2.VirtualMode=VM_ASYNC
USART6.IPParameters=VirtualMode
USART6.VirtualMode=VM_ASYNC
VP_SYS_VS_Systick.Mode=SysTick VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick VP_SYS_VS_Systick.Signal=SYS_VS_Systick
VP_TIM3_VS_ClockSourceINT.Mode=Internal VP_TIM3_VS_ClockSourceINT.Mode=Internal

View File

@ -82,8 +82,6 @@ void Error_Handler(void);
/* Private defines -----------------------------------------------------------*/ /* Private defines -----------------------------------------------------------*/
#define B1_Pin GPIO_PIN_13 #define B1_Pin GPIO_PIN_13
#define B1_GPIO_Port GPIOC #define B1_GPIO_Port GPIOC
#define LD2_Pin GPIO_PIN_5
#define LD2_GPIO_Port GPIOA
#define TMS_Pin GPIO_PIN_13 #define TMS_Pin GPIO_PIN_13
#define TMS_GPIO_Port GPIOA #define TMS_GPIO_Port GPIOA
#define TCK_Pin GPIO_PIN_14 #define TCK_Pin GPIO_PIN_14

View File

@ -65,6 +65,7 @@
TIM_HandleTypeDef htim3; TIM_HandleTypeDef htim3;
UART_HandleTypeDef huart2; UART_HandleTypeDef huart2;
UART_HandleTypeDef huart6;
/* USER CODE BEGIN PV */ /* USER CODE BEGIN PV */
@ -75,6 +76,7 @@ void SystemClock_Config(void);
static void MX_GPIO_Init(void); static void MX_GPIO_Init(void);
static void MX_USART2_UART_Init(void); static void MX_USART2_UART_Init(void);
static void MX_TIM3_Init(void); static void MX_TIM3_Init(void);
static void MX_USART6_UART_Init(void);
/* USER CODE BEGIN PFP */ /* USER CODE BEGIN PFP */
/* USER CODE END PFP */ /* USER CODE END PFP */
@ -114,6 +116,7 @@ int main(void)
MX_GPIO_Init(); MX_GPIO_Init();
MX_USART2_UART_Init(); MX_USART2_UART_Init();
MX_TIM3_Init(); MX_TIM3_Init();
MX_USART6_UART_Init();
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
/* USER CODE END 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 * @brief GPIO Initialization Function
* @param None * @param None
@ -289,22 +325,12 @@ static void MX_GPIO_Init(void)
__HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_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 */ /*Configure GPIO pin : B1_Pin */
GPIO_InitStruct.Pin = B1_Pin; GPIO_InitStruct.Pin = B1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING; GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct); 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 */ /* USER CODE BEGIN 4 */

View File

@ -220,6 +220,30 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
/* USER CODE END USART2_MspInit 1 */ /* 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 */ /* 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 */
}
} }

View File

@ -29,6 +29,15 @@ menu "On-chip Peripheral Drivers"
bool "Enable UART2 RX DMA" bool "Enable UART2 RX DMA"
depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA
default n 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 endif
menuconfig BSP_USING_I2C1 menuconfig BSP_USING_I2C1
@ -38,14 +47,15 @@ menu "On-chip Peripheral Drivers"
select RT_USING_I2C_BITOPS select RT_USING_I2C_BITOPS
select RT_USING_PIN select RT_USING_PIN
if BSP_USING_I2C1 if BSP_USING_I2C1
comment "Notice: PB8 --> 24; PB9 --> 25"
config BSP_I2C1_SCL_PIN config BSP_I2C1_SCL_PIN
int "i2c1 scl pin number" int "i2c1 scl pin number"
range 0 80 range 0 80
default 30 default 24
config BSP_I2C1_SDA_PIN config BSP_I2C1_SDA_PIN
int "I2C1 sda pin number" int "I2C1 sda pin number"
range 0 80 range 0 80
default 31 default 25
endif endif
menuconfig BSP_USING_PWM menuconfig BSP_USING_PWM

View File

@ -110,9 +110,6 @@
/* Utilities */ /* Utilities */
/* ARM CMSIS */
/* RT-Thread online packages */ /* RT-Thread online packages */
/* IoT - internet of things */ /* IoT - internet of things */