Skip to content

fix: take into account STM32G0B0 USART IRQ multiplexing specificities #1790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cores/arduino/stm32/uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ struct serial_s {
#elif defined(LPUART1_BASE)
#define USART3_IRQn USART3_4_LPUART1_IRQn
#define USART3_IRQHandler USART3_4_LPUART1_IRQHandler
#elif defined(USART5_BASE)
#define USART3_IRQn USART3_4_5_6_IRQn
#define USART3_IRQHandler USART3_4_5_6_IRQHandler
#else
#define USART3_IRQn USART3_4_IRQn
#define USART3_IRQHandler USART3_4_IRQHandler
Expand All @@ -140,6 +143,8 @@ struct serial_s {
#define USART4_IRQn USART3_4_5_6_LPUART1_IRQn
#elif defined(LPUART1_BASE)
#define USART4_IRQn USART3_4_LPUART1_IRQn
#elif defined(USART5_BASE)
#define USART4_IRQn USART3_4_5_6_IRQn
#else
#define USART4_IRQn USART3_4_IRQn
#endif
Expand All @@ -157,6 +162,8 @@ struct serial_s {
#elif defined(STM32G0xx)
#if defined(LPUART2_BASE)
#define USART5_IRQn USART3_4_5_6_LPUART1_IRQn
#elif defined(USART5_BASE)
#define USART5_IRQn USART3_4_5_6_IRQn
#endif
#elif defined(STM32L0xx)
#define USART5_IRQn USART4_5_IRQn
Expand All @@ -174,6 +181,8 @@ struct serial_s {
#elif defined(STM32G0xx)
#if defined(LPUART2_BASE)
#define USART6_IRQn USART3_4_5_6_LPUART1_IRQn
#elif defined(USART5_BASE)
#define USART6_IRQn USART3_4_5_6_IRQn
#endif
#endif /* STM32F0xx */
#endif
Expand Down
4 changes: 2 additions & 2 deletions libraries/SrcWrapper/src/stm32/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ void USART3_IRQHandler(void)
if (uart_handlers[UART4_INDEX] != NULL) {
HAL_UART_IRQHandler(uart_handlers[UART4_INDEX]);
}
#if defined(STM32F030xC) || defined(STM32G0xx) && defined(LPUART2_BASE)
#if defined(STM32F030xC) || defined(STM32G0xx) && (defined(LPUART2_BASE) || defined(USART5_BASE))
if (uart_handlers[UART5_INDEX] != NULL) {
HAL_UART_IRQHandler(uart_handlers[UART5_INDEX]);
}
Expand Down Expand Up @@ -1093,7 +1093,7 @@ void UART5_IRQHandler(void)
* @param None
* @retval None
*/
#if defined(USART6_BASE) && !defined(STM32F0xx)
#if defined(USART6_BASE) && !defined(STM32F0xx) && !defined(STM32G0xx)
void USART6_IRQHandler(void)
{
HAL_NVIC_ClearPendingIRQ(USART6_IRQn);
Expand Down