Quantcast
Channel: Forum - Recent Threads
Viewing all articles
Browse latest Browse all 5781

UART Driver in Framework 1.30 behaves strange

$
0
0

Hello

I want to start a timer in callback function to have a function evaluate the message as soon as there are no more new characters comming in. I can not use read with a defined size.

  • I use UART channel3.
  • I did make Priority of recieve Interrupt to 2 (others to 4)
  • Recieve FIFO is set to Max
  • I use 38400 8bit No parity 2 stop (--> 7chars in 2ms)

I have the Problem that the timer is not restarted if I use a 2ms timer (that is restarted after recieving a char.) Here is my callback:

With 2ms. The timer is interrupting the recieving after 15characters.

If I make the timer much longer (5ms) it works on 25Byte messages. WHY?? What if I get even longer messages. What does "Recieve FIFO" exactly? Or what else is the problem?

void user_uart_callback(uart_callback_args_t * p_args)
{
uint32_t status;

    switch (p_args->event)
    {
        case UART_EVENT_RX_CHAR:
            Receive[p_args->channel].cBuffer[Receive[p_args->channel].iLen] = (char)p_args->data;               // Store received data into user defined buffer when not using read function
            Receive[p_args->channel].iLen++;                                                                    // increment counter
            status = tx_timer_deactivate(&uart3_timer);
            status |= tx_timer_change(&uart3_timer, 2, 0);                    // restart 2ms
            status |= tx_timer_activate(&uart3_timer);
            if(status != SSP_SUCCESS)
            {
                error_trap(status, "tx_timer_change  ");
            }
            break;
        case UART_EVENT_RX_COMPLETE:                                                                            // if size known we can use read function
            // in the app there could b a p_api.read( ..., known_size)
            break;
        case UART_EVENT_TX_COMPLETE:
            g_ioport.p_api->pinWrite(DEN,IOPORT_LEVEL_LOW);             // switch sender to off
            break;
        case UART_EVENT_ERR_OVERFLOW:
            break;
        default:
            break;
    }
}


Viewing all articles
Browse latest Browse all 5781

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>