How to introduce sequential tasks using xEventgroupSync()

e2738729
Posts: 35
Joined: Mon Nov 05, 2018 6:22 pm

How to introduce sequential tasks using xEventgroupSync()

Postby e2738729 » Mon Mar 18, 2019 2:16 pm

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

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: How to introduce sequential tasks using xEventgroupSync()

Postby ESP_Sprite » Tue Mar 19, 2019 8:21 am

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.

e2738729
Posts: 35
Joined: Mon Nov 05, 2018 6:22 pm

Re: How to introduce sequential tasks using xEventgroupSync()

Postby e2738729 » Thu Mar 21, 2019 2:07 am

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.

User avatar
urbanze
Posts: 301
Joined: Sat Jun 10, 2017 9:55 pm
Location: Brazil

Re: How to introduce sequential tasks using xEventgroupSync()

Postby urbanze » Fri Mar 22, 2019 1:11 am

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

e2738729
Posts: 35
Joined: Mon Nov 05, 2018 6:22 pm

Re: How to introduce sequential tasks using xEventgroupSync()

Postby e2738729 » Fri Mar 22, 2019 2:21 am

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

Who is online

Users browsing this forum: Bing [Bot] and 373 guests