Pinning WiFi tasks to specific core possible ?

opcode_x64
Posts: 47
Joined: Sun Jan 13, 2019 5:39 pm

Pinning WiFi tasks to specific core possible ?

Postby opcode_x64 » Wed Feb 13, 2019 6:53 am

Hello community,

is it possible to pin wifi tasks (creating, init, handle, data transfer) to a specific core ? For beginnig, I tried to modify the WiFi/Station example on github. I added the define

Code: Select all

CONFIG_ESP32_WIFI_PINNED_CORE_1 1 
in the sdkconfig.h file and deleted the define line containing CONFIG_......_CORE_0 1.

In the WiFi event handler function/task I read out the CoreID but I only get CoreID:0...

It is not possible to pin wifi tasks to specific core ?

Best regards,
opcode_x64

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Pinning WiFi tasks to specific core possible ?

Postby ESP_igrr » Wed Feb 13, 2019 8:11 am

Are you using Arduino IDE or ESP-IDF?

If Arduino IDE, then the short answer is no (but long answer is yes, if you use arduino-esp32 as an IDF component).

If you use ESP-IDF, you can set Wi-Fi task affinity in menuconfig ("make menuconfig", or "idf.py menuconfig" if you are using CMake based build system). Do not modify sdkconfig.h file manually, as it is an automatically generated file.

CONFIG_ESP32_WIFI_TASK_CORE_ID
CONFIG_TCPIP_TASK_AFFINITY

Note that the event task can not be moved to CPU1, yet, so Wi-Fi events will still be dispatched to CPU0.

opcode_x64
Posts: 47
Joined: Sun Jan 13, 2019 5:39 pm

Re: Pinning WiFi tasks to specific core possible ?

Postby opcode_x64 » Wed Feb 13, 2019 8:46 am

Hello ESP_igrr,

thank you for the very quick reply. Sorry, I am using IDF. I am using the "ATOM IDE with platformIO" on Windows. So how can I call the menuconfig ?

I will clear up what my intention is:
I want to collect data via SPI (simple bit-banging) from an external ADC and send the data over WiFi (TCP/UDP....). My idea was to run the bitganging on core 0 and sending the data on core 1. The question is here if it is enough to put only the Sending-Data-Task on Core 1 and letting the wifi event handlers on core 0.

Best regards,
opcode_x64

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Pinning WiFi tasks to specific core possible ?

Postby ESP_igrr » Wed Feb 13, 2019 9:19 am

No clue about platformio, sorry. You may ask about invoking menuconfig in their support forums. In IDF this is usually done using 'make menuconfig' in the project directory.

Regarding using core 0 for bitbanging — have you considered doing it the other way around, pinning all the WiFi related tasks to core 0, and doing bitbanging on core 1? This should be achievable in the current version of IDF.

Who is online

Users browsing this forum: No registered users and 157 guests