cancel
Showing results for 
Search instead for 
Did you mean: 

UART RX Interrupt doesn't work

Damien Gotfroi
Associate
Posted on July 09, 2018 at 16:57

Hello, 

I have a problem with UART RX interrupt on a STM32F777.

I'm using cube mx, I've well enable interrupt in NVIC for my UART7.

In my code, I do :

HAL_UART_Receive_IT(&huart7, &UART_Data, 1);

So when a character is received, the code enters in 

static HAL_StatusTypeDef UART_Receive_IT(UART_HandleTypeDef *huart)

function.

But here :

/* Check that a Rx process is ongoing */

if(huart->RxState == HAL_UART_STATE_BUSY_RX)

My RxState equals HAL_UART_STATE_READY and not HAL_UART_STATE_BUSY_RX.

So my RX Callback is never called.

Do you have any idea ?

Many thanks and best regards

#uart-callback
3 REPLIES 3
T J
Lead
Posted on July 10, 2018 at 02:33

its much easier to use the DMA in circular mode.

Do you use the Cube ?

Damien Gotfroi
Associate
Posted on July 10, 2018 at 09:23

Yes, I'm using CubeMX.

This is my UART configuration :

0690X0000060LhrQAE.png0690X0000060Li1QAE.png
Doug Kehn
Senior
Posted on July 10, 2018 at 15:13

What is the return value from HAL_UART_Receive_IT()?

I execute the following sequence before the initial call to HAL_UART_Receive_IT():

__HAL_UART_CLEAR_OREFLAG(huart);

__HAL_UART_CLEAR_NEFLAG(huart);

__HAL_UART_CLEAR_FEFLAG(huart);

__HAL_UART_DISABLE_IT(huart, UART_IT_ERR);

In the RxCpltCallback function only HAL_UART_Receive_IT() is called for the next character.