Skip to main content
SoHaeng.Lee
Associate III
October 17, 2017
Question

USART Rx interrupt NOT Work

  • October 17, 2017
  • 26 replies
  • 5174 views
Posted on October 17, 2017 at 18:03

0690X00000608eIQAQ.png

I tested three devices all day long today.

All devices are connected to the USART, but the incoming interrupt does not work at all.

A program that connects the Lo Ra modules, GPS modules, and wifi modules to USART 1 and outputs the data sent to USART 2.

However, the Rx Interrupt does not work at all.

Attach the project file.

Note: this post was migrated and contained many threaded conversations, some content may be missing.
    This topic has been closed for replies.

    26 replies

    Tesla DeLorean
    Guru
    October 17, 2017
    Posted on October 17, 2017 at 20:17

    Does receive work in polled mode? Can you confirm signal performance on a scope?

    Not sure I'd be calling a blocking function like HAL_UART_Transmit() with a 1 second timeout in a callback.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    SoHaeng.Lee
    Associate III
    October 18, 2017
    Posted on October 18, 2017 at 02:49

    Thank you very much.

    I tested your advice, but it still doesn't work.

    I have 4 devices.(stm32f103c8t6, uncle-f446re, stm32f4-disco, stm32f3-disco)

    The result was all the same.

    If you have a similar device, try testing it.

    Setting the delay time of the HAL_UART_Receive_IT function to 1000ms causes the program to stop.

    The polling mode has not yet been tested.

    today, I'll try.

    thanks, civil.

    attached project is for Nucleo-F446re.

    Tesla DeLorean
    Guru
    October 18, 2017
    Posted on October 18, 2017 at 03:01

    I'm not an advocate for the HAL library, but I can tell you from experience the USARTs on these boards function properly. The USART1 PA9/PA10 is not connected suitably on the STM32F4-DISCO to work properly. On that board I use uBlox GPS connected on USART2 PD5/PD6

    To debug USART issues you need to check signals with a scope, and review if RXNE asserts, or other error states are signalled and need clearing.

    It is critical that code in callbacks should not block, because otherwise data loss is bound to occur on one or more interfaces.

    I would avoid parking the Peripheral View of the debugger on the USART

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    John Craven
    Senior
    October 18, 2017
    Posted on October 18, 2017 at 06:15

    You have blocking transmits in both uart1 and uart2 interrupt handlers. 

    Have you done a simpler project to test if you can send and rec (no interrupts) to USB via uart2?

    are your solder bridges on the Nucleo correct for pa2/pa3 to the stlink?

    SoHaeng.Lee
    Associate III
    October 18, 2017
    Posted on October 18, 2017 at 16:21

    Thank you very much for your advice.

    Let's take a closer look at the test. 

    John Craven
    Senior
    October 18, 2017
    Posted on October 18, 2017 at 18:02

    Ok. You say it doesn't work, or your don't get interrupts.

    You don't have anything in you main loop to see if its still running.

    You don't have an error handler for the Uarts.

    I am going to bet you end up with something if you add this and a breakpoint

    volatile uint32_t usarterror;
    
    void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
    {
    usarterror = HAL_UART_GetError(huart);
    // see errors on line 207-212 of stm32f4xx_hal_uart.h
    _Error_Handler(__FILE__, __LINE__);
    }�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

    Yasin Yelkovan
    Associate II
    October 19, 2017
    Posted on October 19, 2017 at 15:45

    I had a similar problem with USART RX interrupts but could not solve it (

    https://community.st.com/0D70X000006SydqSAC

    ). Than I started to use DMA for USART RX  and now I have no problem yet.
    SoHaeng.Lee
    Associate III
    October 20, 2017
    Posted on October 20, 2017 at 03:38

    I attached the sample file I made to your post.

    roseanne qiu
    Associate III
    June 19, 2018
    Posted on June 19, 2018 at 16:33

    Dear Sohaeng:

    I also have the same problem with using Nucleo UART6 without interrupt.

    have you solve the problem? if so , how do you solve? 

    thanks

    roseanne

    Tesla DeLorean
    Guru
    June 19, 2018
    Posted on June 19, 2018 at 16:49

     ,

     ,

    But not the same board right?

    https://community.st.com/0D50X00009XkWIoSAN

     ,
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    roseanne qiu
    Associate III
    June 19, 2018
    Posted on June 19, 2018 at 18:04

    Dear Clive:

    same board. I have both uart and timer interrupt problems. 

    the reset problem has been found only on my PC connecting to the nucleo board, 

    if the nucleo is connected to other PC, there is no problem.

    thanks

    rose