Page 1 of 1
Why is Arduino's main task pinned to core 1?
Posted: Sat Feb 11, 2017 2:29 am
by MartyMacGyver
I'm working on porting an RMT-driven NeoPixel/WS2812 driver to Arduino-ESP32 and in doing so I noticed that the main task is pinned to core 1:
Code: Select all
xTaskCreatePinnedToCore(loopTask, "loopTask", 4096, NULL, 1, NULL, 1);
Why is that? I've run with core 0 and no core at all (just xTaskCreate) and my sketches still work fine, insofar as it works at all. However, on the default pinned core 1 my port is not working and as I'm debugging that this came up. Thoughts?
Re: Why is Arduino's main task pinned to core 1?
Posted: Sat Feb 11, 2017 3:39 am
by WiFive
System tasks are pinned to core 0 so user tasks are pinned to core 1 in general. It doesn't have to be but is a straightforward way to try and distribute the load between the CPUs.
Also:
https://github.com/espressif/esp-idf/bl ... ore-issues
You may want to check the interrupts are not hardcoded to cpu0 in the code you are porting.
Re: Why is Arduino's main task pinned to core 1?
Posted: Sat Feb 11, 2017 5:28 am
by WiFive
Looks like they are in fact hardcoded
https://github.com/MartyMacGyver/ESP32- ... 812.c#L149
Code: Select all
intr_matrix_set(0, ETS_RMT_INTR_SOURCE, ETS_RMT_CTRL_INUM);
Try
Code: Select all
intr_matrix_set(xPortGetCoreID(), ETS_RMT_INTR_SOURCE, ETS_RMT_CTRL_INUM);
Although you may want to switch to the new interrupt allocator too.
Re: Why is Arduino's main task pinned to core 1?
Posted: Sat Feb 11, 2017 8:43 am
by MartyMacGyver
You found the repo - and your fix worked! The update is pushed... I've got lots to do but getting this to work with the Arduino-ESP32 will hopefully be of benefit to those who wanted to see this working.
I really appreciate your help - I still need to learn more about how everything operates at this level. Tell me more of this new interrupt allocator... at least, what to keyword search on. (Or is it simply what was linked to above?)
Thank you again!
Re: Why is Arduino's main task pinned to core 1?
Posted: Sat Feb 11, 2017 9:06 am
by WiFive
Yes it is described in that same link.
Re: Why is Arduino's main task pinned to core 1?
Posted: Wed Feb 15, 2017 1:29 pm
by MartyMacGyver
Along with several other updates, I'm now using the new interrupt allocator. Thanks again for the tip!
Re: Why is Arduino's main task pinned to core 1?
Posted: Mon May 29, 2017 8:04 am
by electronicsguy
MartyMacGyver wrote:Along with several other updates, I'm now using the new interrupt allocator. Thanks again for the tip!
could you share your code describing how?
Also please update the links, they're broken.
Re: Why is Arduino's main task pinned to core 1?
Posted: Mon May 29, 2017 8:41 am
by MartyMacGyver
This is the driver I ported and extended:
https://github.com/MartyMacGyver/ESP32- ... ED-Drivers
As for the interrupt allocator info, a search shows it moved here:
https://github.com/espressif/esp-idf/bl ... _alloc.rst
Re: Why is Arduino's main task pinned to core 1?
Posted: Mon Oct 30, 2017 8:36 am
by classical
The WiFi client is handled to be a part of the user program.
So the user program and the WiFi are running on the same core1.
If you have time critical operations like input countings running on application you get an interference with the wifi.
Is it possible in the arduino world to shift the wifi ont core0 so that you can do time critical actions on core1 without interference with wifi?