Extra character in UART RX buffer
I'm trying to receive data through USART1 using STM32F407. I decided to not use HAL api's to achieve that, so I'm receiving character by character and storing them in an array. Every character I send is received correctly but apart from the actual data I'm receiving an extra character in the first position of the buffer. It sometimes is a 'p' , sometimes a '\n' . I'm attaching some debug screenshots and a code snippet.
I enable the RX DR not empty interrupt:
__HAL_UART_ENABLE_IT(&huart1,UART_IT_RXNE);
My interrupt handler:
uint8_t group_input_str[250];
volatile uint32_t idx = 0;
void USART1_IRQHandler(void)
{
/* USER CODE BEGIN USART1_IRQn 0 */
if(__HAL_UART_GET_IT_SOURCE(&huart1,UART_IT_RXNE))
{
group_input_str[idx++] = huart1.Instance->DR;
}
if(idx>=250) // prevent overflow
idx=249;
/* USER CODE END USART1_IRQn 0 */
HAL_UART_IRQHandler(&huart1);
/* USER CODE BEGIN USART1_IRQn 1 */
/* USER CODE END USART1_IRQn 1 */
}
I sent a buffer containing help from the very begining, from another board(STM32F103),and the logic analiser caught :

But on the debugger I got:

UART configurations in both boards: 115200,8,N,1
I lowered down the baud rate, switched from HSE(8 MHz) to HSI, lowered down SYSCLK from 100MHz to 16MHz, but no success. What could be wrong?
