8000 esp32: Pin MicroPython and NimBLE tasks to core 0. · micropython/micropython@311b851 · GitHub
[go: up one dir, main page]

Skip to content

Commit 311b851

Browse files
jimmodpgeorge
authored andcommitted
esp32: Pin MicroPython and NimBLE tasks to core 0.
MicroPython and NimBLE must be on the same core, for synchronisation of the BLE ringbuf and the MicroPython scheduler. However, in the current IDF versions (3.3 and 4.0) there are issues (see e.g. #5489) with running NimBLE on core 1. This change - pinning both tasks to core 0 - makes it possible to reliably run the BLE multitests on esp32 boards.
1 parent 99a29ec commit 311b851

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

ports/esp32/boards/sdkconfig.ble

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ CONFIG_BT_NIMBLE_ENABLED=y
99
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4
1010

1111
# Pin to the same core as MP.
12-
CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=n
13-
CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y
14-
CONFIG_BT_NIMBLE_PINNED_TO_CORE=1
12+
# Until we move to IDF 4.2+, we need NimBLE on core 0, and for synchronisation
13+
# with the ringbuffer and scheduler MP needs to be on the same core.
14+
# See https://github.com/micropython/micropython/issues/5489
15+
CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=y
16+
CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=n
17+
CONFIG_BT_NIMBLE_PINNED_TO_CORE=0
1518

1619
# v3.3-only (renamed in 4.0)
1720
CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y

ports/esp32/mphalport.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@
3535
#include "freertos/FreeRTOS.h"
3636
#include "freertos/task.h"
3737

38-
// The core that the MicroPython task(s) are pinned to
39-
#define MP_TASK_COREID (1)
38+
// The core that the MicroPython task(s) are pinned to.
39+
// Until we move to IDF 4.2+, we need NimBLE on core 0, and for synchronisation
40+
// with the ringbuffer and scheduler MP needs to be on the same core.
41+
// See https://github.com/micropython/micropython/issues/5489
42+
#define MP_TASK_COREID (0)
4043

4144
extern TaskHandle_t mp_main_task_handle;
4245

0 commit comments

Comments
 (0)
0