2 core enable in esp32.

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
prem111
Posts: 111
Joined: Sun Feb 23, 2020 3:18 pm

2 core enable in esp32.

Post by prem111 » Tue Feb 23, 2021 7:22 am

Is it possible to safely enable 2 core in esp32 in the latest version 1.14? The shutdown was due to a problem with ble init, in esp-idf 4.2 I see that it already works, can I turn it on without fear?

User avatar
jimmo
Posts: 2244
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: 2 core enable in esp32.

Post by jimmo » Wed Feb 24, 2021 12:57 am

prem111 wrote:
Tue Feb 23, 2021 7:22 am
Is it possible to safely enable 2 core in esp32 in the latest version 1.14? The shutdown was due to a problem with ble init, in esp-idf 4.2 I see that it already works, can I turn it on without fear?
I don't think it's been tested, but yes if you're using IDF 4.2, then you can probably run MicroPython on either core.

However, you still need to run Bluetooth on the same core.

i.e. MP_TASK_COREID needs to be the same as CONFIG_BT_NIMBLE_PINNED_TO_CORE, but they don't need to be zero.

prem111
Posts: 111
Joined: Sun Feb 23, 2020 3:18 pm

Re: 2 core enable in esp32.

Post by prem111 » Wed Feb 24, 2021 6:56 am

Ok. Are there any differences in speed or performance if MP is assigned to core 0 or 1?

And one more question, is it possible to declare on which core the MP should be, after compiling the firmware?

Thanks.

User avatar
jimmo
Posts: 2244
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: 2 core enable in esp32.

Post by jimmo » Thu Feb 25, 2021 12:22 am

prem111 wrote:
Wed Feb 24, 2021 6:56 am
Ok. Are there any differences in speed or performance if MP is assigned to core 0 or 1?
Yes, it's faster when it runs on a different core to the system functionality (e.g. wifi).

I realise the current situation is a bit sub-optimal, but it's currently known to work, which is why MicroPython is using it. Now that we've moved to the new build system for ESP32, somebody needs to spend some time properly researching this across the different configurations (wifi, ble, different IDF versions) and come up with a recommendation for how to improve it in the future.
prem111 wrote:
Wed Feb 24, 2021 6:56 am
And one more question, is it possible to declare on which core the MP should be, after compiling the firmware?
No, this can only be set at compile time.

prem111
Posts: 111
Joined: Sun Feb 23, 2020 3:18 pm

Re: 2 core enable in esp32.

Post by prem111 » Thu Feb 25, 2021 7:33 am

I checked with 1.14 and 4.2 idf. This works, but there is a problem because some operations like writing to a file and simultaneous ble connection, esp will freezes without any messages.

Post Reply