AnsweredAssumed Answered

USART escape sequence and interrupt.

Question asked by sink on Sep 5, 2013
Latest reply on Sep 5, 2013 by sink
Hi,
I am using
STM324x9I-EVAL, which has a 32F439 chip with Keil tools chain and StdPeriph Lib, 1.2RC2, FreeRTOS 7.5.
The following is the section of interrupt code.

void USART1_IRQHandler(void)
{
  portBASE_TYPE higherPriorityTask;
  
  if(USART_GetITStatus(EVAL_COM1, USART_IT_RXNE) != RESET)
  {
    // Read one byte from the receive data register 
    // aRxBuffer[uhRxCounter++] = (USART_ReceiveData(EVAL_COM1) & 0x7F);
    while (aRxByte != 0)
      vTaskDelay(5);
    aRxByte = USART_ReceiveData(EVAL_COM1);
    if (xSemaphoreGiveFromISR(semaRXDAvail, &higherPriorityTask) == pdFALSE)
      errorReg[EBUartRXSemaFail] |= EMUartRXSemaFail;
  }
......

The program works well if the input is "normal" characters. However, when the received char is 0x1B (escape). Then it will wandering inside the stm32f4xx_usart.c and no longer getting any RXNE interrupt. What's the correct way to handle the escape sequence?
Thanks,
Sink.

Outcomes