aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Mussared2020-08-19 10:46:09 +1000
committerDamien George2020-09-08 12:53:24 +1000
commit311b8519af75be9fe4215b5ee8f77e91d089d5df (patch)
tree7ef1b06fda38732fe049d5a879220a6c2df34bfb
parent99a29ec705b463290d5a2ac1eabc46fb7f2a83b0 (diff)
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.
-rw-r--r--ports/esp32/boards/sdkconfig.ble9
-rw-r--r--ports/esp32/mphalport.h7
2 files changed, 11 insertions, 5 deletions
diff --git a/ports/esp32/boards/sdkconfig.ble b/ports/esp32/boards/sdkconfig.ble
index cdbb621a6..f714ce462 100644
--- a/ports/esp32/boards/sdkconfig.ble
+++ b/ports/esp32/boards/sdkconfig.ble
@@ -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
diff --git a/ports/esp32/mphalport.h b/ports/esp32/mphalport.h
index 1f78d820a..60cc308d6 100644
--- a/ports/esp32/mphalport.h
+++ b/ports/esp32/mphalport.h
@@ -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;