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.
This commit is contained in:
Jim Mussared 2020-08-19 10:46:09 +10:00 committed by Damien George
parent 99a29ec705
commit 311b8519af
2 changed files with 11 additions and 5 deletions

View File

@ -9,9 +9,12 @@ CONFIG_BT_NIMBLE_ENABLED=y
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4
# Pin to the same core as MP.
CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=n
CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y
CONFIG_BT_NIMBLE_PINNED_TO_CORE=1
# Until we move to IDF 4.2+, we need NimBLE on core 0, and for synchronisation
# with the ringbuffer and scheduler MP needs to be on the same core.
# See https://github.com/micropython/micropython/issues/5489
CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=y
CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=n
CONFIG_BT_NIMBLE_PINNED_TO_CORE=0
# v3.3-only (renamed in 4.0)
CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y

View File

@ -35,8 +35,11 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
// The core that the MicroPython task(s) are pinned to
#define MP_TASK_COREID (1)
// The core that the MicroPython task(s) are pinned to.
// Until we move to IDF 4.2+, we need NimBLE on core 0, and for synchronisation
// with the ringbuffer and scheduler MP needs to be on the same core.
// See https://github.com/micropython/micropython/issues/5489
#define MP_TASK_COREID (0)
extern TaskHandle_t mp_main_task_handle;