Hello,
I am currently working on a project where an ESP32 based board needs to communicate with a computer via Ethernet.
Is there any way to pin all Ethernet related tasks to core 1, as for the Wi-Fi task in menuconfig ?
I should specify that I am using the driver in standalone mode (without TCP/IP stack).
Thanks in advance,
Maxime
Pin Ethernet related tasks to core 1 [IDFGH-3383]
Re: Pin Ethernet related tasks to core 1
The reaction to a incoming packet needs to be as fast as possible, that's why being able to pin that to one core would be very helpful.
Any insight on this ?
Any insight on this ?
Re: Pin Ethernet related tasks to core 1
Tasks are core mobile unless told not to be. Interrupts are tied to the creating core.
main is core 0 so launch a task pinned to core 1 and from that task initialise ethernet resolves interrupts.
You did not say which Ethernet tasks you want pinned. HTTP, mDNS, DNS etc?
Gets to be a bit of a system question & so I will ask; why do you think that pinning to core 1 will help & expecially as other system tasks may float into core 1. Would not a priority system be better?
Also re: 'fast as possible' - would be better for you to state your time constraint. OOM I can tell you if it could fly. You have after all achieved your own 'fast as possible'
EDIT: I would add that you're Ethernet protocol & its setup matter a load. Its wrong to ask for solution without requirement but were you thinking UDP, TCP or higher e.g. HTTP? There are just so many performance issues relating so I will wait for your requirement.
main is core 0 so launch a task pinned to core 1 and from that task initialise ethernet resolves interrupts.
You did not say which Ethernet tasks you want pinned. HTTP, mDNS, DNS etc?
Gets to be a bit of a system question & so I will ask; why do you think that pinning to core 1 will help & expecially as other system tasks may float into core 1. Would not a priority system be better?
Also re: 'fast as possible' - would be better for you to state your time constraint. OOM I can tell you if it could fly. You have after all achieved your own 'fast as possible'
EDIT: I would add that you're Ethernet protocol & its setup matter a load. Its wrong to ask for solution without requirement but were you thinking UDP, TCP or higher e.g. HTTP? There are just so many performance issues relating so I will wait for your requirement.
& I also believe that IDF CAN should be fixed.
Re: Pin Ethernet related tasks to core 1
Hi !
Thank you for your answer.
The board I'm working on is used in a legged robot as a bridge between a control computer using Ethernet and a set of sensors and actuators using SPI. The control loop is working at 1kHz.
Then, we need the Ethernet communication, and especially the receiving callback, to happen in a negligeable amount of time against the 1ms period (10 to 100µs).
As most of the loop time is used for SPI communication, we can't really afford any extra latency coming from the Ethernet data transfer between our ESP board and the computer. That's why we want to make these tasks independant by having SPI on core 0 and Ethernet on core 1.
Also, we are using raw ethernet frames at MAC level, so no TCP/IP layer or anything.
The project : https://open-dynamic-robot-initiative.github.io/
The ESP32 firmware : https://github.com/maximekli/master-boa ... r/firmware
Thank you for your time,
Maxime
Thank you for your answer.
The board I'm working on is used in a legged robot as a bridge between a control computer using Ethernet and a set of sensors and actuators using SPI. The control loop is working at 1kHz.
Then, we need the Ethernet communication, and especially the receiving callback, to happen in a negligeable amount of time against the 1ms period (10 to 100µs).
As most of the loop time is used for SPI communication, we can't really afford any extra latency coming from the Ethernet data transfer between our ESP board and the computer. That's why we want to make these tasks independant by having SPI on core 0 and Ethernet on core 1.
Also, we are using raw ethernet frames at MAC level, so no TCP/IP layer or anything.
The project : https://open-dynamic-robot-initiative.github.io/
The ESP32 firmware : https://github.com/maximekli/master-boa ... r/firmware
Thank you for your time,
Maxime
-
- Posts: 290
- Joined: Wed Sep 05, 2018 6:23 am
Re: Pin Ethernet related tasks to core 1
Fantastic project @maximekli
Ethernet driver does have a dedicated task to doing packets receiving stuffs. Unfortunately, there's no way to pin that task to a specific core for now. But it's easy to add that support in esp-idf and won't break any API. I think it's reasonable to have such an option. Will do it!
By now, you can hack esp-idf code a little to pin the task to the core you want: https://github.com/espressif/esp-idf/bl ... p32.c#L458
Ethernet driver does have a dedicated task to doing packets receiving stuffs. Unfortunately, there's no way to pin that task to a specific core for now. But it's easy to add that support in esp-idf and won't break any API. I think it's reasonable to have such an option. Will do it!
By now, you can hack esp-idf code a little to pin the task to the core you want: https://github.com/espressif/esp-idf/bl ... p32.c#L458
Re: Pin Ethernet related tasks to core 1 [IDFGH-3383]
Moderator's note: edit the topic title for issue tracking, thanks.
Re: Pin Ethernet related tasks to core 1
Thank you for your answer, that would be great !
Maxime
This litlle hack worked perfectly, thanks.ESP_morris wrote: ↑Wed May 27, 2020 10:15 amBy now, you can hack esp-idf code a little to pin the task to the core you want: https://github.com/espressif/esp-idf/bl ... p32.c#L458
Maxime
Who is online
Users browsing this forum: No registered users and 123 guests