AnsweredAssumed Answered

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

Question asked by Ch.Pradeep on Feb 6, 2017

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,

Outcomes