2023-05-02 09:44 PM
void USART3_IRQHandler(void) is incorrect, since USARTs 3/4 share the interrupt, it doesn't compile. What replaces 'USART3' in the interrupt handler?
NVIC_ClearPendingIRQ(USART3_IRQn); is incorrect since USART3 3/4 share the interrupt. What replaces 'USART3_IRQn' so that the NVIC_ClearPendingIRQ will compile?
Solved! Go to Solution.
2023-05-02 10:30 PM
The interrupt handler names are defined in the startup code, like in startup_stm32g070xx.s:
.word USART1_IRQHandler /* USART1 */
.word USART2_IRQHandler /* USART2 */
.word USART3_4_IRQHandler /* USART3, USART4 */
If you create code with UART 3/4 interrupts enabled, you find the code in stm32g0xx_hal_msp.c:
HAL_NVIC_SetPriority(USART3_4_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(USART3_4_IRQn);
Those defines are from CMSIS like stm32g070xx.h.
The generated code is correct and does compile without errors.
hth
KnarfB
2023-05-02 10:28 PM
You check and service both peripherals and the flags should clear.
I think in one of the recent threads it establishes the combined symbol and number for the IRQ. Grep the library source or truncate the Handler name seen in startup.s
2023-05-02 10:30 PM
YOUR thread here https://community.st.com/s/question/0D53W00002FEy7wSAD/i-there-a-usart3irqn-and-a-usart4irqn-on-stm32g070
2023-05-02 10:30 PM
The interrupt handler names are defined in the startup code, like in startup_stm32g070xx.s:
.word USART1_IRQHandler /* USART1 */
.word USART2_IRQHandler /* USART2 */
.word USART3_4_IRQHandler /* USART3, USART4 */
If you create code with UART 3/4 interrupts enabled, you find the code in stm32g0xx_hal_msp.c:
HAL_NVIC_SetPriority(USART3_4_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(USART3_4_IRQn);
Those defines are from CMSIS like stm32g070xx.h.
The generated code is correct and does compile without errors.
hth
KnarfB
2023-05-04 08:03 AM
Everyone, thanks for your help... compiles, so I presume that it will work.