Skip to content

Commit d4f5f28

Browse files
ABOSTMfpistm
authored andcommitted
fix: take into account STM32G0B0 USART IRQ multiplexing specificities (stm32duino#1790)
Signed-off-by: Alexandre Bourdiol <[email protected]> Co-authored-by: Frederic Pillon <[email protected]>
1 parent 4fd3a04 commit d4f5f28

File tree

2 files changed

+11
-2
lines changed
  • cores/arduino/stm32
  • libraries/SrcWrapper/src/stm32

2 files changed

+11
-2
lines changed

cores/arduino/stm32/uart.h

+9
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ struct serial_s {
116116
#elif defined(LPUART1_BASE)
117117
#define USART3_IRQn USART3_4_LPUART1_IRQn
118118
#define USART3_IRQHandler USART3_4_LPUART1_IRQHandler
119+
#elif defined(USART5_BASE)
120+
#define USART3_IRQn USART3_4_5_6_IRQn
121+
#define USART3_IRQHandler USART3_4_5_6_IRQHandler
119122
#else
120123
#define USART3_IRQn USART3_4_IRQn
121124
#define USART3_IRQHandler USART3_4_IRQHandler
@@ -140,6 +143,8 @@ struct serial_s {
140143
#define USART4_IRQn USART3_4_5_6_LPUART1_IRQn
141144
#elif defined(LPUART1_BASE)
142145
#define USART4_IRQn USART3_4_LPUART1_IRQn
146+
#elif defined(USART5_BASE)
147+
#define USART4_IRQn USART3_4_5_6_IRQn
143148
#else
144149
#define USART4_IRQn USART3_4_IRQn
145150
#endif
@@ -157,6 +162,8 @@ struct serial_s {
157162
#elif defined(STM32G0xx)
158163
#if defined(LPUART2_BASE)
159164
#define USART5_IRQn USART3_4_5_6_LPUART1_IRQn
165+
#elif defined(USART5_BASE)
166+
#define USART5_IRQn USART3_4_5_6_IRQn
160167
#endif
161168
#elif defined(STM32L0xx)
162169
#define USART5_IRQn USART4_5_IRQn
@@ -174,6 +181,8 @@ struct serial_s {
174181
#elif defined(STM32G0xx)
175182
#if defined(LPUART2_BASE)
176183
#define USART6_IRQn USART3_4_5_6_LPUART1_IRQn
184+
#elif defined(USART5_BASE)
185+
#define USART6_IRQn USART3_4_5_6_IRQn
177186
#endif
178187
#endif /* STM32F0xx */
179188
#endif

libraries/SrcWrapper/src/stm32/uart.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ void USART3_IRQHandler(void)
10241024
if (uart_handlers[UART4_INDEX] != NULL) {
10251025
HAL_UART_IRQHandler(uart_handlers[UART4_INDEX]);
10261026
}
1027-
#if defined(STM32F030xC) || defined(STM32G0xx) && defined(LPUART2_BASE)
1027+
#if defined(STM32F030xC) || defined(STM32G0xx) && (defined(LPUART2_BASE) || defined(USART5_BASE))
10281028
if (uart_handlers[UART5_INDEX] != NULL) {
10291029
HAL_UART_IRQHandler(uart_handlers[UART5_INDEX]);
10301030
}
@@ -1093,7 +1093,7 @@ void UART5_IRQHandler(void)
10931093
* @param None
10941094
* @retval None
10951095
*/
1096-
#if defined(USART6_BASE) && !defined(STM32F0xx)
1096+
#if defined(USART6_BASE) && !defined(STM32F0xx) && !defined(STM32G0xx)
10971097
void USART6_IRQHandler(void)
10981098
{
10991099
HAL_NVIC_ClearPendingIRQ(USART6_IRQn);

0 commit comments

Comments
 (0)