cancel
Showing results for 
Search instead for 
Did you mean: 

I use STM32F030R8T8 programming with CUBE and TrueStudio. I have a problem with the frame error in UART communication on RS485 line. I have implemented the error_callback function to reset the error, but receiving remains blocked.

SDeGr
Associate

In a similar question it is recommended to carry out the instructions:

void HAL_UART_ErrorCallback (UART_HandleTypeDef * huart)

{

// I implement this .. but eventually you can decide with different approach

// Many macros / proc on this code .. is just to be a hint (mem / rec about this possibility)

__HAL_UART_CLEAR_OREFLAG (huart);

__HAL_UART_CLEAR_NEFLAG (huart);

__HAL_UART_CLEAR_FEFLAG (huart);

/ * Disable the UART Error Interrupt: (Frame error, noise error, overrun error) * /

__HAL_UART_DISABLE_IT (huart, UART_IT_ERR);

// The most important thing when UART framing error occur / any error is restart the RX process

if (huart-> Instance == USART1)

{

// Restarting the RX, .. 1 byte. .. u8DATRxBuffer is My own rx buffer

HAL_UART_Receive_IT (huart, u8DATRxBuffer1, 1);

}

}

But HAL_UART_Receive_IT always returns with HAL_Ko,

blocking reception.

I think further resets are missing ...

0 REPLIES 0