I’m looking for some example code the shows how to set up a freeRTOS software timer. Basically I’m trying to recieve a fixed packet length on the UART of three consecutive bytes. I created a task that recieves the characters from the UART and builds the 3 byte packet and sends the completed packet via message queue to another task.
Within the task that builds the three byte packet, I’d like to incorporate a timer that will track elapsed time and flag an error if the three bytes aren’t recieved within a specified time.
So the process would be this;
Uart character recieved;
get initial timer value, start timer ;
wait for second byte; check timer elapsed;
wait for third byte; check timer elapsed;
if three bytes received within the specified time, message off packet to other task with error flag clear
else if timer elapsed set error flag and message off to other task with packet array clear
clear intial timer value, stop timer
Any help is greatly appreciated.