[bsp/stm32] add art-pi uart3

This commit is contained in:
supperthomas 2020-11-25 00:09:50 +08:00
parent 7fc7600eca
commit a6c57d9640
8 changed files with 239 additions and 28 deletions

View File

@ -115,7 +115,7 @@ 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_SYSTEM_WORKQUEUE is not set
CONFIG_RT_USING_SERIAL=y CONFIG_RT_USING_SERIAL=y
CONFIG_RT_SERIAL_USING_DMA=y # CONFIG_RT_SERIAL_USING_DMA is not set
CONFIG_RT_SERIAL_RB_BUFSZ=64 CONFIG_RT_SERIAL_RB_BUFSZ=64
# CONFIG_RT_USING_CAN is not set # CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set # CONFIG_RT_USING_HWTIMER is not set
@ -442,7 +442,7 @@ CONFIG_SOC_SERIES_STM32H7=y
# #
# Hardware Drivers Config # Hardware Drivers Config
# #
CONFIG_SOC_STM32H750IB=y CONFIG_SOC_STM32H750XB=y
# #
# Onboard Peripheral Drivers # Onboard Peripheral Drivers
@ -454,7 +454,7 @@ CONFIG_SOC_STM32H750IB=y
# #
CONFIG_BSP_USING_GPIO=y CONFIG_BSP_USING_GPIO=y
CONFIG_BSP_USING_UART=y CONFIG_BSP_USING_UART=y
CONFIG_BSP_USING_UART1=y CONFIG_BSP_USING_UART3=y
CONFIG_BSP_USING_UART4=y CONFIG_BSP_USING_UART4=y
# CONFIG_BSP_USING_SDIO is not set # CONFIG_BSP_USING_SDIO is not set
# CONFIG_BSP_USING_CRC is not set # CONFIG_BSP_USING_CRC is not set

View File

@ -45,7 +45,7 @@ STM32H750 是RTTHREAD推出的一款基于 ARM Cortex-M7 内核的开发板,
| LCD RG888 | 待支持 | 显示屏接口 | | LCD RG888 | 待支持 | 显示屏接口 |
| **片上外设** | **支持情况** | **备注** | | **片上外设** | **支持情况** | **备注** |
| GPIO | 支持 | | | GPIO | 支持 | |
| UART | 支持 | UART1 | | UART | 支持 | UART4 UART3 |
| SPI | 支持 | SPI | | SPI | 支持 | SPI |
| QSPI | 支持 | | | QSPI | 支持 | |
| | | | | | | |

View File

@ -113,6 +113,9 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
GPIO_InitStruct.Alternate = GPIO_AF8_UART4; GPIO_InitStruct.Alternate = GPIO_AF8_UART4;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* UART4 interrupt Init */
HAL_NVIC_SetPriority(UART4_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(UART4_IRQn);
/* USER CODE BEGIN UART4_MspInit 1 */ /* USER CODE BEGIN UART4_MspInit 1 */
/* USER CODE END UART4_MspInit 1 */ /* USER CODE END UART4_MspInit 1 */
@ -147,6 +150,11 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
GPIO_InitStruct.Alternate = GPIO_AF7_USART3; GPIO_InitStruct.Alternate = GPIO_AF7_USART3;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/* USART3 interrupt Init */
HAL_NVIC_SetPriority(USART3_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(USART3_IRQn);
NVIC_EnableIRQ(USART3_IRQn);
/* USER CODE BEGIN USART3_MspInit 1 */ /* USER CODE BEGIN USART3_MspInit 1 */
/* USER CODE END USART3_MspInit 1 */ /* USER CODE END USART3_MspInit 1 */
@ -178,6 +186,8 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0);
/* UART4 interrupt DeInit */
HAL_NVIC_DisableIRQ(UART4_IRQn);
/* USER CODE BEGIN UART4_MspDeInit 1 */ /* USER CODE BEGIN UART4_MspDeInit 1 */
/* USER CODE END UART4_MspDeInit 1 */ /* USER CODE END UART4_MspDeInit 1 */
@ -200,6 +210,8 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_11|GPIO_PIN_12); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_11|GPIO_PIN_12);
/* USART3 interrupt DeInit */
HAL_NVIC_DisableIRQ(USART3_IRQn);
/* USER CODE BEGIN USART3_MspDeInit 1 */ /* USER CODE BEGIN USART3_MspDeInit 1 */
/* USER CODE END USART3_MspDeInit 1 */ /* USER CODE END USART3_MspDeInit 1 */

View File

@ -56,7 +56,8 @@
/* USER CODE END 0 */ /* USER CODE END 0 */
/* External variables --------------------------------------------------------*/ /* External variables --------------------------------------------------------*/
extern UART_HandleTypeDef huart4;
extern UART_HandleTypeDef huart3;
/* USER CODE BEGIN EV */ /* USER CODE BEGIN EV */
/* USER CODE END EV */ /* USER CODE END EV */
@ -197,6 +198,34 @@ void SysTick_Handler(void)
/* please refer to the startup file (startup_stm32h7xx.s). */ /* please refer to the startup file (startup_stm32h7xx.s). */
/******************************************************************************/ /******************************************************************************/
/**
* @brief This function handles USART3 global interrupt.
*/
void USART3_IRQHandler(void)
{
/* USER CODE BEGIN USART3_IRQn 0 */
/* USER CODE END USART3_IRQn 0 */
HAL_UART_IRQHandler(&huart3);
/* USER CODE BEGIN USART3_IRQn 1 */
/* USER CODE END USART3_IRQn 1 */
}
/**
* @brief This function handles UART4 global interrupt.
*/
void UART4_IRQHandler(void)
{
/* USER CODE BEGIN UART4_IRQn 0 */
/* USER CODE END UART4_IRQn 0 */
HAL_UART_IRQHandler(&huart4);
/* USER CODE BEGIN UART4_IRQn 1 */
/* USER CODE END UART4_IRQn 1 */
}
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
/* USER CODE END 1 */ /* USER CODE END 1 */

View File

@ -14,15 +14,16 @@ Mcu.Name=STM32H750XBHx
Mcu.Package=TFBGA240 Mcu.Package=TFBGA240
Mcu.Pin0=PI9 Mcu.Pin0=PI9
Mcu.Pin1=PI8 Mcu.Pin1=PI8
Mcu.Pin2=PH1-OSC_OUT (PH1) Mcu.Pin10=VP_SYS_VS_Systick
Mcu.Pin3=PH0-OSC_IN (PH0) Mcu.Pin2=PI11
Mcu.Pin4=PA0 Mcu.Pin3=PH1-OSC_OUT (PH1)
Mcu.Pin5=PB10 Mcu.Pin4=PH0-OSC_IN (PH0)
Mcu.Pin6=PB11 Mcu.Pin5=PA0
Mcu.Pin7=PD11 Mcu.Pin6=PB10
Mcu.Pin8=PD12 Mcu.Pin7=PB11
Mcu.Pin9=VP_SYS_VS_Systick Mcu.Pin8=PD11
Mcu.PinsNb=10 Mcu.Pin9=PD12
Mcu.PinsNb=11
Mcu.ThirdPartyNb=0 Mcu.ThirdPartyNb=0
Mcu.UserConstants= Mcu.UserConstants=
Mcu.UserName=STM32H750XBHx Mcu.UserName=STM32H750XBHx
@ -38,6 +39,8 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
NVIC.UART4_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.USART3_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
PA0.Locked=true PA0.Locked=true
PA0.Mode=Asynchronous PA0.Mode=Asynchronous
@ -56,6 +59,8 @@ PH0-OSC_IN\ (PH0).Mode=HSE-External-Oscillator
PH0-OSC_IN\ (PH0).Signal=RCC_OSC_IN PH0-OSC_IN\ (PH0).Signal=RCC_OSC_IN
PH1-OSC_OUT\ (PH1).Mode=HSE-External-Oscillator PH1-OSC_OUT\ (PH1).Mode=HSE-External-Oscillator
PH1-OSC_OUT\ (PH1).Signal=RCC_OSC_OUT PH1-OSC_OUT\ (PH1).Signal=RCC_OSC_OUT
PI11.Locked=true
PI11.Signal=GPIO_Output
PI8.Locked=true PI8.Locked=true
PI8.Signal=GPIO_Output PI8.Signal=GPIO_Output
PI9.Locked=true PI9.Locked=true

View File

@ -10,7 +10,7 @@ config SOC_STM32H750XB
menu "Onboard Peripheral Drivers" menu "Onboard Peripheral Drivers"
config BSP_USING_QSPI_FLASH config BSP_USING_QSPI_FLASH
bool "Enable QSPI FLASH (W25Q256)" bool "Enable QSPI FLASH (W25Q64)"
select BSP_USING_QSPI select BSP_USING_QSPI
select RT_USING_SFUD select RT_USING_SFUD
select RT_SFUD_USING_QSPI select RT_SFUD_USING_QSPI
@ -29,8 +29,8 @@ menu "On-chip Peripheral Drivers"
default y default y
select RT_USING_SERIAL select RT_USING_SERIAL
if BSP_USING_UART if BSP_USING_UART
config BSP_USING_UART1 config BSP_USING_UART3
bool "Enable UART1" bool "Enable UART3"
default y default y
config BSP_USING_UART4 config BSP_USING_UART4

View File

@ -117,6 +117,26 @@
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon> <pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
</DebugOpt> </DebugOpt>
<TargetDriverDllRegistry> <TargetDriverDllRegistry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMRTXEVENTFLAGS</Key>
<Name>-L70 -Z18 -C0 -M0 -T1</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGTARM</Key>
<Name>(1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMDBGFLAGS</Key>
<Name></Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGUARM</Key>
<Name>(105=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>UL2CM3</Key> <Key>UL2CM3</Key>
@ -128,19 +148,159 @@
<Name>-U066BFF393732484257162540 -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32H7x_128k -FS08000000 -FL020000</Name> <Name>-U066BFF393732484257162540 -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32H7x_128k -FS08000000 -FL020000</Name>
</SetRegEntry> </SetRegEntry>
</TargetDriverDllRegistry> </TargetDriverDllRegistry>
<Breakpoint/> <Breakpoint>
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>516</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134238434</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\libraries\HAL_Drivers\drv_usart.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\rt_thread\../libraries/HAL_Drivers/drv_usart.c\516</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>105</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134264914</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>applications\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\rt_thread\applications/main.c\105</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>108</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134262562</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\libraries\HAL_Drivers\drv_usart.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\rt_thread\../libraries/HAL_Drivers/drv_usart.c\108</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>115</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134262586</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\libraries\HAL_Drivers\drv_usart.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\rt_thread\../libraries/HAL_Drivers/drv_usart.c\115</Expression>
</Bp>
<Bp>
<Number>4</Number>
<Type>0</Type>
<LineNumber>164</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134262714</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\libraries\HAL_Drivers\drv_usart.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\rt_thread\../libraries/HAL_Drivers/drv_usart.c\164</Expression>
</Bp>
<Bp>
<Number>5</Number>
<Type>0</Type>
<LineNumber>222</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134262916</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\libraries\HAL_Drivers\drv_usart.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\rt_thread\../libraries/HAL_Drivers/drv_usart.c\222</Expression>
</Bp>
<Bp>
<Number>6</Number>
<Type>0</Type>
<LineNumber>224</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134262950</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\libraries\HAL_Drivers\drv_usart.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\rt_thread\../libraries/HAL_Drivers/drv_usart.c\224</Expression>
</Bp>
</Breakpoint>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>uart</ItemText>
</Ww>
<Ww>
<count>1</count>
<WinNumber>1</WinNumber>
<ItemText>baud_rate</ItemText>
</Ww>
<Ww>
<count>2</count>
<WinNumber>1</WinNumber>
<ItemText>cfg-&gt;baud_rate,0x0A</ItemText>
</Ww>
<Ww>
<count>3</count>
<WinNumber>1</WinNumber>
<ItemText>huart</ItemText>
</Ww>
<Ww>
<count>4</count>
<WinNumber>1</WinNumber>
<ItemText>uart-&gt;handle</ItemText>
</Ww>
</WatchWindow1>
<Tracepoint> <Tracepoint>
<THDelay>0</THDelay> <THDelay>0</THDelay>
</Tracepoint> </Tracepoint>
<DebugFlag> <DebugFlag>
<trace>0</trace> <trace>0</trace>
<periodic>0</periodic> <periodic>0</periodic>
<aLwin>0</aLwin> <aLwin>1</aLwin>
<aCover>0</aCover> <aCover>0</aCover>
<aSer1>0</aSer1> <aSer1>0</aSer1>
<aSer2>0</aSer2> <aSer2>0</aSer2>
<aPa>0</aPa> <aPa>0</aPa>
<viewmode>0</viewmode> <viewmode>1</viewmode>
<vrSel>0</vrSel> <vrSel>0</vrSel>
<aSym>0</aSym> <aSym>0</aSym>
<aTbox>0</aTbox> <aTbox>0</aTbox>
@ -171,6 +331,12 @@
<pszMrulep></pszMrulep> <pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp> <pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp> <pMultCmdsp></pMultCmdsp>
<SystemViewers>
<Entry>
<Name>System Viewer\USART3</Name>
<WinId>35905</WinId>
</Entry>
</SystemViewers>
<DebugDescription> <DebugDescription>
<Enable>1</Enable> <Enable>1</Enable>
<EnableFlashSeq>1</EnableFlashSeq> <EnableFlashSeq>1</EnableFlashSeq>
@ -203,7 +369,7 @@
<Group> <Group>
<GroupName>cpu</GroupName> <GroupName>cpu</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -479,7 +645,7 @@
<Group> <Group>
<GroupName>finsh</GroupName> <GroupName>finsh</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -523,7 +689,7 @@
<Group> <Group>
<GroupName>Kernel</GroupName> <GroupName>Kernel</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -699,7 +865,7 @@
<Group> <Group>
<GroupName>libc</GroupName> <GroupName>libc</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -719,7 +885,7 @@
<Group> <Group>
<GroupName>STM32_HAL</GroupName> <GroupName>STM32_HAL</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>

View File

@ -78,7 +78,6 @@
#define RT_USING_DEVICE_IPC #define RT_USING_DEVICE_IPC
#define RT_PIPE_BUFSZ 512 #define RT_PIPE_BUFSZ 512
#define RT_USING_SERIAL #define RT_USING_SERIAL
#define RT_SERIAL_USING_DMA
#define RT_SERIAL_RB_BUFSZ 64 #define RT_SERIAL_RB_BUFSZ 64
#define RT_USING_PIN #define RT_USING_PIN
@ -153,7 +152,7 @@
/* Hardware Drivers Config */ /* Hardware Drivers Config */
#define SOC_STM32H750IB #define SOC_STM32H750XB
/* Onboard Peripheral Drivers */ /* Onboard Peripheral Drivers */
@ -162,7 +161,7 @@
#define BSP_USING_GPIO #define BSP_USING_GPIO
#define BSP_USING_UART #define BSP_USING_UART
#define BSP_USING_UART1 #define BSP_USING_UART3
#define BSP_USING_UART4 #define BSP_USING_UART4
/* Board extended module Drivers */ /* Board extended module Drivers */