STM32 Uart Overrun
Hello every one .
this is my first post so excuse me if i do something wrong.
I try to establish Uart Asynchronous line between two stm32f303k8 .one of them use basic timer to send 8 byte uint buffer every 200 mili-sec and the other use HAL_UART_Receive_IT first in the "/* USER CODE BEGIN 2 */"
and circularly recall it again in HAL_UART_RxCpltCallback.
So my problem is that after the first reception i get overrun error and when i enable overrun in the CubeMX i see that after the first reception the first byte are the last byte of the previous message and all other bytes are shifted right .
**I attached image of my UART configuration (same for both of them)
Sender variables :
uint8_t m_tx_buffer[8] = {0};
uint8_t flag = 0;
Sender while(1):
if (flag == 1)
{
flag = 0;
HAL_UART_Transmit_IT(&huart1, m_tx_buffer, sizeof(m_tx_buffer));
m_tx_buffer[5] ++;
}
Receiver variables :
volatile uint8_t s_rx_buffer[8] = {0};
uint8_t s_tx_buffer[8] = {0};
uint8_t flag = 0;
Receiver Callback :
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
while(HAL_UART_GetState(huart) == HAL_UART_STATE_BUSY);
memset(s_rx_buffer, 0, sizeof(s_rx_buffer));
HAL_UART_Receive_IT(huart, s_rx_buffer, sizeof(s_rx_buffer));
}
I basically try everything, and it is not working. I try to move to DMA and i try to change the word length of the Uart I try to use slowing the sending of messages and try to see other's post on the internet. and i really not understanding how to fix that.
Source code formatting applied
