When I started ESP32, it can be seen from the log, is a single core mode. Here is the log.
I (637) cpu_start: Single core mode
I (642) cpu_start: Pro cpu start user code
How can I make it to be dual core mode after I started ESP32?
How to set dual core mode?
Re: How to set dual core mode?
Menuconfig freertos on both cores. Then pin a task to cpu1 or it won't initialize scheduler (bug).
Re: How to set dual core mode?
I did "make menuconfig"and make freertos on both cores.But after ESP32 start,from log,It's still single core mode.WiFive wrote:Menuconfig freertos on both cores. Then pin a task to cpu1 or it won't initialize scheduler (bug).
Re: How to set dual core mode?
Did you reflash bootloader?
Re: How to set dual core mode?
actually IDF
used hello world demo -> https://github.com/espressif/esp-idf/tr ... ello_world
Dual Core:
result:
Single Core:
result:
best wishes
rudi
used hello world demo -> https://github.com/espressif/esp-idf/tr ... ello_world
Dual Core:
result:
I (44) boot: ESP-IDF v2.0-rc1-73-g61c7bd3 2nd stage bootloader
I (44) boot: compile time 11:30:52
I (44) boot: Enabling RNG early entropy source...
I (64) boot: SPI Speed : 40MHz
I (77) boot: SPI Mode : DIO
I (89) boot: SPI Flash Size : 4MB
I (102) boot: Partition Table:
I (113) boot: ## Label Usage Type ST Offset Length
I (136) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (159) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (182) boot: 2 factory factory app 00 00 00010000 00100000
I (206) boot: End of partition table
I (219) boot: Disabling RNG early entropy source...
I (236) boot: Loading app partition at offset 00010000
I (518) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512)
I (519) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x02ecc ( 11980) map
I (535) boot: segment 2: paddr=0x00022edc vaddr=0x3ffb0000 size=0x01af0 ( 6896) load
I (564) boot: segment 3: paddr=0x000249d4 vaddr=0x40080000 size=0x00400 ( 1024) load
I (588) boot: segment 4: paddr=0x00024ddc vaddr=0x40080400 size=0x08858 ( 34904) load
I (630) boot: segment 5: paddr=0x0002d63c vaddr=0x400c0000 size=0x00000 ( 0) load
I (640) boot: segment 6: paddr=0x0002d644 vaddr=0x00000000 size=0x029c4 ( 10692)
I (665) boot: segment 7: paddr=0x00030010 vaddr=0x400d0018 size=0x0e094 ( 57492) map
I (691) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (714) heap_alloc_caps: At 3FFB22F8 len 0002DD08 (183 KiB): DRAM
I (735) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (756) heap_alloc_caps: At 40088C58 len 000173A8 (92 KiB): IRAM
I (777) cpu_start: Pro cpu up.
I (788) cpu_start: Starting app cpu, entry point is 0x40080a5c
I (0) cpu_start: App cpu up.
I (819) cpu_start: Pro cpu start user code
I (880) cpu_start: Starting scheduler on PRO CPU.
I (81) cpu_start: Starting scheduler on APP CPU.
Hello world!
Restarting in 10 seconds...
Restarting in 9 seconds...
Restarting in 8 seconds...
Restarting in 7 seconds...
Single Core:
result:
I (44) boot: ESP-IDF v2.0-rc1-73-g61c7bd3 2nd stage bootloader
I (44) boot: compile time 11:34:55
I (45) boot: Enabling RNG early entropy source...
I (65) boot: SPI Speed : 40MHz
I (77) boot: SPI Mode : DIO
I (90) boot: SPI Flash Size : 4MB
I (102) boot: Partition Table:
I (113) boot: ## Label Usage Type ST Offset Length
I (136) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (159) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (182) boot: 2 factory factory app 00 00 00010000 00100000
I (206) boot: End of partition table
I (219) boot: Disabling RNG early entropy source...
I (236) boot: Loading app partition at offset 00010000
I (518) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512)
I (518) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x02d38 ( 11576) map
I (534) boot: segment 2: paddr=0x00022d48 vaddr=0x3ffb0000 size=0x012ec ( 4844) load
I (563) boot: segment 3: paddr=0x0002403c vaddr=0x40080000 size=0x00400 ( 1024) load
I (587) boot: segment 4: paddr=0x00024444 vaddr=0x40080400 size=0x08444 ( 33860) load
I (629) boot: segment 5: paddr=0x0002c890 vaddr=0x400c0000 size=0x00000 ( 0) load
I (639) boot: segment 6: paddr=0x0002c898 vaddr=0x00000000 size=0x03770 ( 14192)
I (664) boot: segment 7: paddr=0x00030010 vaddr=0x400d0018 size=0x0df48 ( 57160) map
I (691) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (714) heap_alloc_caps: At 3FFB1AB0 len 0002E550 (185 KiB): DRAM
I (734) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (756) heap_alloc_caps: At 40088844 len 000177BC (93 KiB): IRAM
I (776) cpu_start: Pro cpu up.
I (788) cpu_start: Single core mode
I (800) cpu_start: Pro cpu start user code
I (860) cpu_start: Starting scheduler on PRO CPU.
Hello world!
Restarting in 10 seconds...
Restarting in 9 seconds...
Restarting in 8 seconds...
Restarting in 7 seconds...
best wishes
rudi
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
Re: How to set dual core mode?
I (44) boot: ESP-IDF v2.0-rc1-73-g61c7bd3 2nd stage bootloader
I (44) boot: compile time 12:27:30
I (45) boot: Enabling RNG early entropy source...
I (64) boot: SPI Speed : 40MHz
I (77) boot: SPI Mode : DIO
I (89) boot: SPI Flash Size : 4MB
I (102) boot: Partition Table:
I (113) boot: ## Label Usage Type ST Offset Length
I (136) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (159) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (182) boot: 2 factory factory app 00 00 00010000 00100000
I (206) boot: End of partition table
I (219) boot: Disabling RNG early entropy source...
I (236) boot: Loading app partition at offset 00010000
I (518) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512)
I (518) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x02eb4 ( 11956) map
I (534) boot: segment 2: paddr=0x00022ec4 vaddr=0x3ffb0000 size=0x01af0 ( 6896) load
I (564) boot: segment 3: paddr=0x000249bc vaddr=0x40080000 size=0x00400 ( 1024) load
I (588) boot: segment 4: paddr=0x00024dc4 vaddr=0x40080400 size=0x08858 ( 34904) load
I (630) boot: segment 5: paddr=0x0002d624 vaddr=0x400c0000 size=0x00000 ( 0) load
I (639) boot: segment 6: paddr=0x0002d62c vaddr=0x00000000 size=0x029dc ( 10716)
I (664) boot: segment 7: paddr=0x00030010 vaddr=0x400d0018 size=0x0e008 ( 57352) map
I (691) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (714) heap_alloc_caps: At 3FFB22F8 len 0002DD08 (183 KiB): DRAM
I (735) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (756) heap_alloc_caps: At 40088C58 len 000173A8 (92 KiB): IRAM
I (776) cpu_start: Pro cpu up.
I (788) cpu_start: Starting app cpu, entry point is 0x40080a5c
I (0) cpu_start: App cpu up.
I (819) cpu_start: Pro cpu start user code
I (880) cpu_start: Starting scheduler on PRO CPU.
I (81) cpu_start: Starting scheduler on APP CPU.
Hello world from core 0!
Hello world from core 1!
Hello world from core 0!
Hello world from core 1!
Hello world from core 0!
Hello world from core 0!
Hello world from core 1!
Code: Select all
/* Hello World Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "nvs_flash.h"
#define core_0 0
#define core_1 1
void hello_task_core_1(void *pvParameter)
{
while(1){
printf("Hello world from core %d!\n", xPortGetCoreID() );
vTaskDelay(872 / portTICK_PERIOD_MS);
fflush(stdout);
}
}
void hello_task_core_0(void *pvParameter)
{
while(1) {
printf("Hello world from core %d!\n", xPortGetCoreID() );
vTaskDelay(1323 / portTICK_PERIOD_MS);
fflush(stdout);
}
}
void app_main()
{
nvs_flash_init();
xTaskCreatePinnedToCore(&hello_task_core_0, "core1_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_0);
xTaskCreatePinnedToCore(&hello_task_core_1, "core0_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_1);
}
rudi
edit:
if you have tested and wounder why your process hang up
posted hand made code here with a mistake on core numbers core_0, core_1 and the print messages to "core1_task", "core0_task"
Code: Select all
xTaskCreatePinnedToCore(&hello_task_core_1, "core1_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_0);
xTaskCreatePinnedToCore(&hello_task_core_0, "core0_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_1);
and have edit by hand only the last param ( core_0 , core_1 to core_1, core_0 ) after i have seen
that was difference code to my running example,
Code: Select all
xTaskCreatePinnedToCore(&hello_task_core_1, "core1_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_1);
xTaskCreatePinnedToCore(&hello_task_core_0, "core0_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_0);
but have posted my running outputs
( it runs because the core_0 was start as first ..( mistake printf..core1_task )I (880) cpu_start: Starting scheduler on PRO CPU.
I (81) cpu_start: Starting scheduler on APP CPU.
Code: Select all
xTaskCreatePinnedToCore(&hello_task_core_1, "core1_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_0);
xTaskCreatePinnedToCore(&hello_task_core_0, "core0_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_1);
now have changed on posted code the enumeration on TaskCreatedPinnedToCore
from ( just in time not running code )
Code: Select all
xTaskCreatePinnedToCore(&hello_task_core_1, "core1_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_1);
xTaskCreatePinnedToCore(&hello_task_core_0, "core0_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_0);
to ( running code )
I (880) cpu_start: Starting scheduler on PRO CPU.
I (81) cpu_start: Starting scheduler on APP CPU.
Code: Select all
xTaskCreatePinnedToCore(&hello_task_core_0, "core1_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_0);
xTaskCreatePinnedToCore(&hello_task_core_1, "core0_task", 1024*4, NULL, configMAX_PRIORITIES - 1, NULL, core_1);
now it is same code like here at my desk the code and output run.
further info see here
btw..
No one noticed the wrong mistake in code posting from me?
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
Re: How to set dual core mode?
How to specify Esp32 WIFI to use CPU0 or CPU1?
Who is online
Users browsing this forum: Google [Bot] and 149 guests