Issue detecting and processing usart receive
Hello again,
Here's what I want to do:
1) wait for the UART_FLAG_RXNE to be set
2) receive one character
3) switch based on that character (character is saved for further processing)
4) receive the proper number of following characters based on the command in #3
in the example below, when UART_FLAG_RXNE is set, no matter how I try, I only receive one character. In the command processing switch, I tried clearing various flags without effect. This is a simple example, the other part of the code where we receive a command from a GPS unit uses a switch statement for each returned value as they are received so we would really like to receive a select number of characters at a time. Polling is fine as we can't do anything until the commands are all processed. Also, there is a wide number of following characters based on the command. This is on a 32f769.
Thanks in advance for any help and the help in the past.
Jerry
if(__HAL_UART_GET_FLAG(&huart1, UART_FLAG_RXNE)==SET){ // check if data is available
HAL_UART_Receive(&huart1,recBuf,1,100); // receive the first character
c=recBuf[0];
switch (c) {
case 'c': // Cnnnn set coarse DAC
// tried clearing ORE, RXNE, etc here but recieve below times out.
HAL_UART_Receive(&huart1,recBuf,4,1000); // get the next 4 chars