Core usage with Arduino

perigalacticon
Posts: 15
Joined: Thu Dec 07, 2017 3:59 am

Core usage with Arduino

Postby perigalacticon » Wed May 30, 2018 11:24 pm

Hello,

As an Arduino user I am looking for hopefully definitive answers to these questions regarding dual core usage on ESP32 with Arduino code:

My understanding is that Arduino code runs on Core#1, named APP_CPU. And low-level WIFI operations run on Core#0, named PRO_CPU.

1. Is the above statement correct?
2. If so, do any WIFI operations (ie. interrrupts) also run on Core#1 ?
3. Which core is more free of resources or interrupts in general ?

ESP_Dazz
Posts: 308
Joined: Fri Jun 02, 2017 6:50 am

Re: Core usage with Arduino

Postby ESP_Dazz » Mon Jul 16, 2018 8:54 am

perigalacticon wrote:My understanding is that Arduino code runs on Core#1, named APP_CPU. And low-level WIFI operations run on Core#0, named PRO_CPU.
Yes that is correct. What happens is a FreeRTOS task that is pinned to Core 1 is created (called loopTask). The loopTask
will run setup() once, then run loop() repeatedly (see source code here).
perigalacticon wrote:2. If so, do any WIFI operations (ie. interrrupts) also run on Core#1 ?
In theory there shouldn't be, as interrupts are allocated to whichever core the allocation API was called from. Since the WiFi tasks runs on Core 0, its corresponding interrupts should also be allocated to Core 0.
perigalacticon wrote:3. Which core is more free of resources or interrupts in general ?
Core 1 is generally more free of resources. The underlying intention is to have Core 0 handle most protocol processing (hence PRO_CPU) and have the application code run mostly on Core 1 (hence APP_CPU). However there might be cases where the application code requires heavy processing whilst there is minimal protocol processing, in which case it would make sense to shift some application processing to Core 0.

Who is online

Users browsing this forum: No registered users and 151 guests