cancel
Showing results for 
Search instead for 
Did you mean: 

IRDA RECEPTION ERRORS AT 38400bps

varani luciano
Associate III
Posted on July 06, 2018 at 07:27

Hi,

I'm using a Nucleo-F401RE whith HSE at  9.8304MHz.

I try to receive, on UART6, IRDA frames of unknown dimension : from 4 to 60 bytes max; the third code received specify, by a table, the length of the frame. (STX, DEST ADDRESS, COMMAND_CODE, (N-PARAMETERS))

Interrupt is enabled and  I'm using  receiveng byte after byte:

HAL_IRDA_Receive_IT(&hirda6, DataTemp,1);

IRDA settings are:

  hirda6.Init.BaudRate = 38400;

  hirda6.Init.WordLength = IRDA_WORDLENGTH_8B;

  hirda6.Init.Parity = IRDA_PARITY_NONE;

  hirda6.Init.Mode = IRDA_MODE_TX_RX;

  hirda6.Init.Prescaler = 1;

  hirda6.Init.IrDAMode = IRDA_POWERMODE_NORMAL;

Receiving is made by a personal procedure due to the arriving  frames:

void USART6_IRQHandler(void)

    {

    uint32_t isrflags   = READ_REG(hirda6.Instance->SR);

    uint32_t cr1its     = READ_REG(hirda6.Instance->CR1);

     /*UART Receiver? -----------------------------------------------*/

    if(((isrflags & USART_SR_RXNE) != RESET) && ((cr1its & USART_CR1_RXNEIE) != RESET))

        {

         /*data ready?*/

        if(hirda6.Instance->SR & USART_SR_RXNE)

                 {

                 temp=hirda6.Instance->DR;

                 Buffer_irDA_RX[irDA_RX_index] = temp;

                 if(irDA_RX_index++>irDA_RX_MAX

                           dataAnalize();  //where I close the communication and reset IRDA

                 else if(irDA_R_index==3)

                     irDA_RX_MAX=Table[temp];

           }

    }

The question: after 4 bytes received system 'stops' the reception  for sometime, so some bytes are irrecuperable (may be 5 or 6) From debugger NO ERRORS FOUND OF ANY TYPE ON IRDA

Some Idea?  many thanks.

Luciano

1 REPLY 1
Posted on July 12, 2018 at 18:44

You should perhaps look if the USART is flagging an framing or noise errors.

The variables and mechanics here are not visible.

Any processing/analysis needs to complete within one byte time.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..