Page 1 of 1
How to introduce sequential tasks using xEventgroupSync()
Posted: Mon Mar 18, 2019 2:16 pm
by e2738729
Hi everyone,
I am planning to use EventGroup to synchronize between 2 tasks: one is to send data over TCP/IP and the other is to receive data from PC over TCP/IP. My question is:
1. Should I use xEventGroupSync() for this? And how can I set this up?
2. If not, can I use vTaskSuspend? What about binary semaphore?
Please note that these two tasks will run forever
Thanks,
e2738729
Re: How to introduce sequential tasks using xEventgroupSync()
Posted: Tue Mar 19, 2019 8:21 am
by ESP_Sprite
Hard to say without knowing what your architecture is... can you explain a bit more about what you're trying to do and in which way you think you'd need synchronization?
Edit: Moving to General Discussion as this is not hardware-related.
Re: How to introduce sequential tasks using xEventgroupSync()
Posted: Thu Mar 21, 2019 2:07 am
by e2738729
Thank you for your reply.
I was wondering if I can have a task that happens after another task a specific amount of time (ticks). I read through the documentation of the xEventGroupSync and it appears to me that I am not able to do so.
Is there a way that I can achieve this?
For example, the sending task to PC via TCP/IP will happen 1 second before the receiving task from PC via TCP/IP.
Thanks.
Re: How to introduce sequential tasks using xEventgroupSync()
Posted: Fri Mar 22, 2019 1:11 am
by urbanze
Since event groups unlock all tasks waiting for it, priority will select witch will run first. Why dont use this? Just put higger prio in tcp_send() and lower in tcp_read(), both on same core.
You tested this? Should work, I think
Re: How to introduce sequential tasks using xEventgroupSync()
Posted: Fri Mar 22, 2019 2:21 am
by e2738729
I am not sure if that is what I wanted. I would like to maintain a fixed timing offset between the sending task and the receive task, and both of them will run infinitely.
Would it is possible to achieve this? Assuming that there is no packet resending or congestion.
Thanks