Skip to main content
Dick Lin
Senior
October 25, 2018
Question

USART1_IRQHandler ISR routine not been called?

  • October 25, 2018
  • 8 replies
  • 2687 views

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,

****

    This topic has been closed for replies.

    8 replies

    Pavel A.
    October 25, 2018

    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
    Dick LinAuthor
    Senior
    October 25, 2018

    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
    Senior III
    October 25, 2018

    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

    Tesla DeLorean
    Guru
    October 25, 2018

    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Pavel A.
    October 25, 2018

    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
    Dick LinAuthor
    Senior
    October 25, 2018

    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

    Tesla DeLorean
    Guru
    October 25, 2018

    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Dick Lin
    Dick LinAuthor
    Senior
    October 25, 2018

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

     // RXNE Interrupt Enable

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