cancel
Showing results for 
Search instead for 
Did you mean: 

USART1_IRQHandler ISR routine not been called?

Dick Lin
Senior

Hi,

I am using a STM32F407VE MCU board with USART1 as debug port. I am able to output string to USART1 but not receiving. This ISR routine never been trigger after I enter some chars from teraterm.

I do believe I setup the ISR in .s file and enable ISR routine. Not sure whats going on.

Any comments?

Thanks,

****

8 REPLIES 8
Pavel A.
Evangelist III

Enable ISR routine? What is this - enable NVIC or UART interrupts? Both are needed. Do you use ST's HAL or LL library or something home rolled?

-- pa

Dick Lin
Senior

I believe I did both. See below. Thx

In startup_stm32f407xx.s -

 .word   USART1_IRQHandler         /* USART1            */          

 .word   USART2_IRQHandler         /* USART2            */          

 .word   USART3_IRQHandler         /* USART3            */ 

In uart.c -

  /* USART1 interrupt Init */

  HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);

  HAL_NVIC_EnableIRQ(USART1_IRQn);

T J
Lead

do you use the cube ?

I had to enable the DMA and the Uart interrupt,

please check my posts, here:

https://community.st.com/s/question/0D50X00009sVTZFSA4/haluartreceivedma-calls-rxcpltcallback-but-receives-no-data

Check for framing, parity and noise type errors, and clear them.

Could just be it's not receiving anything properly. RX not enabled, wrong pin, noisy signals, inversion.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Pavel A.
Evangelist III

If you use HAL_UART_Receive_IT or HAL_UART_Transmit_IT - these functions enable needed UART interrupts (*), so you're done. Check other reasons why interrupt does not arrive. Functions without _IT in their name simply do not use interrupts, if you use these functions, it is normal that no UART interrupts occur.

-- pa

(*) for example: https://github.com/pavel-a/stm32f4_libs/blob/c4560650ddaea6ee33de171027d801a31109565a/STM32Cube_FW_F4/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c#L736

Dick Lin
Senior

I do get into USART1_IRQHandler() for TX just not for RX when I have input from teraterm through Prolific USB to serial Comm port. Thx

Kind of hard to debug with no code, no schematic, and no scope traces.

Make sure the status register isn't flagging errors, that the interrupt for RXNE is enabled. Check peripheral registers in debugger. Check wiring and pin numbers. Probe signal at pin.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Dick Lin
Senior

Got it now, need enable RX interrupt in CR1. Thx

 // RXNE Interrupt Enable

 SET_BIT(huart1.Instance->CR1, USART_CR1_RXNEIE);