Dual core
Re: Dual core
You will need these headers to create another task/thread on the other cpu:
You can call setup2() in setup().
In setup2() you can create the second loop task.
xTaskCreatePinnedToCore(loop2,"loop2", 4096, NULL, ESP_TASK_PRIO_MIN, NULL, 1); //4096 is the stacksize, last argument is the cpu(0 or 1
or create a setup2() task that calls loop2()
See arduino-esp32 https://github.com/espressif/arduino-es ... 2/main.cpp
Code: Select all
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_tasks.h"
In setup2() you can create the second loop task.
xTaskCreatePinnedToCore(loop2,"loop2", 4096, NULL, ESP_TASK_PRIO_MIN, NULL, 1); //4096 is the stacksize, last argument is the cpu(0 or 1
or create a setup2() task that calls loop2()
See arduino-esp32 https://github.com/espressif/arduino-es ... 2/main.cpp
Re: Dual core
So, In short, xTaskCreatePinnedToCore is useful function for you with last argument as to create task for CPU0 or CPU1 based on your task, it's handler, size and it's priority.
As per my understanding, By default if you will directly use xTaskCreate API then it will create task for CPU1 as CPU0 is dedicated for WiFi and Bluetooth by default.
As per my understanding, By default if you will directly use xTaskCreate API then it will create task for CPU1 as CPU0 is dedicated for WiFi and Bluetooth by default.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: Dual core
thanks!
if i not use this functions, the code is usually run in core 0? core 1? or in two in same time? any datasheet for this informations?
if i not use this functions, the code is usually run in core 0? core 1? or in two in same time? any datasheet for this informations?
Re: Dual core
No it will create task with no affinity meaning it will run on either core, whichever is available.Ritesh wrote:As per my understanding, By default if you will directly use xTaskCreate API then it will create task for CPU1 as CPU0 is dedicated for WiFi and Bluetooth by default.
Re: Dual core
Ok. But WiFi and Bluetooth Core is CPU0 for dedicated purpose. Correct?WiFive wrote:No it will create task with no affinity meaning it will run on either core, whichever is available.Ritesh wrote:As per my understanding, By default if you will directly use xTaskCreate API then it will create task for CPU1 as CPU0 is dedicated for WiFi and Bluetooth by default.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: Dual core
and, if i want to call a X function in core 1, i need to call this function in corr 0, but, if code is slowly in core 0, this affect core 1 functionz?WiFive wrote:No it will create task with no affinity meaning it will run on either core, whichever is available.Ritesh wrote:As per my understanding, By default if you will directly use xTaskCreate API then it will create task for CPU1 as CPU0 is dedicated for WiFi and Bluetooth by default.
Re: Dual core
@urbanze,
A question if I may. Do you really need "dual core" or do you need "multi task"?
What is the nature of your solution where you think you need to harness the power of dual core processors as opposed to a potential logical design where your design calls for multi-tasking?
You can run multiple parallel loops with multi-tasking that don't involve multi-core. I'd like to hear your use case that calls for true dual core support?
A question if I may. Do you really need "dual core" or do you need "multi task"?
What is the nature of your solution where you think you need to harness the power of dual core processors as opposed to a potential logical design where your design calls for multi-tasking?
You can run multiple parallel loops with multi-tasking that don't involve multi-core. I'd like to hear your use case that calls for true dual core support?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Dual core
Hi,urbanze wrote:thanks!
if i not use this functions, the code is usually run in core 0? core 1? or in two in same time? any datasheet for this informations?
If you have looked into make menuconfig configurations for your application then there is one options defined into configuration like "[*] Run FreeRTOS only on first core" in freeRTOS section in which you can explicitly execute freeRTOS stuffs (like Tasks, Queues and other stuffs) into CPU0 core.
If you will not use this function and also not select above configuration from make menuconfig configuration then whatever task you have created might be executed either on core 0 or core 1 which is dependent on stack availability.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: Dual core
no, i possible never really need dual core, BUT, i like to make benchmark's and compare mcu's,etc.. in my home automation, i have +10 sensor's and 2 hmi interface, dual core could help me.Ritesh wrote:Hi,urbanze wrote:thanks!
if i not use this functions, the code is usually run in core 0? core 1? or in two in same time? any datasheet for this informations?
If you have looked into make menuconfig configurations for your application then there is one options defined into configuration like "[*] Run FreeRTOS only on first core" in freeRTOS section in which you can explicitly execute freeRTOS stuffs (like Tasks, Queues and other stuffs) into CPU0 core.
If you will not use this function and also not select above configuration from make menuconfig configuration then whatever task you have created might be executed either on core 0 or core 1 which is dependent on stack availability.
Who is online
Users browsing this forum: Gaston1980 and 145 guests