cancel
Showing results for 
Search instead for 
Did you mean: 

UART- Packet data to be received and processed - Timing handler

pradeepsysargus
Associate II
Posted on February 06, 2017 at 13:32

I have data coming through UART interrupt to STM32F4, I need to stop receiving bytes after say 20millsec.

It was implemented using Std peripheral library, I am trying to implement the same in HAL library:

void LoggerInterfaceEOPHandler(void)

{

if(LoggerInterface.EOP_Timer != 0) 

LoggerInterface.EOP_Timer--;

if(LoggerInterface.EOP_Timer == 0) 

LoggerInterface.RxInterfaceEvent = 1;

}

void TickHandler(uint32_t data)

{

// Blocking Timer Handling

LoggerInterfaceEOPHandler();

}

In the UART ISR, after every byte reception, I assign variable LoggerInterface.EOP_Timer = 20 (20 msec). The above function LoggerInterfaceEOPHandler() decrement 20 msec every 1 msec in steps.

Usually, individual bytes of a packet are received in less than 20 msec, so LoggerInterface.RxInterfaceEvent variable will not be 1.

After a packet reception, when there is no more data to come for a while, LoggerInterface.EOP_Timer become 0 and LoggerInterface.RxInterfaceEvent becomes 1 and the received packet or buffer is processed.

Could some one point how to implement this kind of operation in HAL library ?

Thanks,

#stm32f4-uart #usart-interrupt
0 REPLIES 0