cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronization of UART ISR with Multiple "State machine" task in FreeRTOS

Xxoyo.1
Associate III

Hello everyone,

I have to synchronize with UART's TC and IDLE interrupts with my Multiple state-machines i.e. (3 big state machine tasks, TX state machine, RX state machine and main state machine).

Currently, I have used osMessageQueuePut and osMessageQueueGet between the ISR-to-Tasks, and Tasks-to-Tasks , that will help synchronize. But the main issue is the complexity of the system making it harder to debug i.e. sometime the message queue have timeout ...

Not only that, the State Machine has more than 1 state that requires to use 2-3 messageQueues , making it really hard to keep track.

I would like to know which would be a better approach for handling this application? Using binary semaphore instead?

Thanks

1 REPLY 1

Hello @Xxoyo.1​ ,

It is not easy to preconize a solution when it is not clear what is the actual application, what data should be exchanged, etc... In addition to that debugging multithreaded and distributed systems is usually really hard (GNU Hurd is a cautionary story about this).

From what I understood from your post, the issue is mainly a synchronization issue. Personally, this would mean to me that your application needs a re-architecture and I'd take inspiration for publish subscribe architectures (PublishSubscribe.pdf (uwaterloo.ca)) which are well suited for what you described.

Hope this helps/inspires you.

Best regards,

Walid