Question
LL_USART_ClearFlag_RXNE(USART3) doesn't work properly but it worked normally when i use USART3->SR &= ~USART_SR_RXNE
i use stm32f407vgt chip with my own board design
and working on STM32CubeIDE_1.3.0
void USART3_IRQHandler(void)
{
/* USER CODE BEGIN USART3_IRQn 0 */
//USART3->SR &= ~USART_SR_RXNE;
LL_USART_ClearFlag_RXNE(USART3);
static unsigned char iteration,buffer[4],validation;
unsigned char data;
data = USART3->DR; // the character from the USART1 data register is saved in t
dat3 = data;
dat6 = validation;
if(data == 'Z')
{
validation = 1;
iteration = 0;
}
else if(validation == 1)
{
if(data == 'Y')
{
validation = 2;
}
else validation = 0;
}
else if(validation == 2)
{
buffer[iteration]=data;
iteration++;
if(iteration == 4)
{
//move to global variable
acc_y = buffer[0];
acc_x = buffer[1];
gyro_p = buffer[2];
gyro_r = buffer[3];
//convert to signed integer
if(acc_y >= 128) acc_y -= 256;
if(acc_x >= 128) acc_x -= 256;
if(gyro_p >= 128) gyro_p -= 256;
if(gyro_r >= 128) gyro_r -= 256;
//to get value 0 at default pose
acc_x -= acc_x_offset;
acc_y -= acc_y_offset;
gyro_p -= gyro_p_offset;
gyro_r -= gyro_r_offset;
iteration = 0;
validation = 0;
}
}
/* USER CODE END USART3_IRQn 0 */
/* USER CODE BEGIN USART3_IRQn 1 */
/* USER CODE END USART3_IRQn 1 */
}I prefer as much as possible using the default function in LL driver for good regeneration
