esp32: Pin MicroPython to core 1 again.
This follows up on #5489, where we changed the esp32 core pinning to core 0 in order to work around an issue with IDF < 4.2.0. Now that IDF > 4.2.0 is available, we allow pinning back to core 1, which eliminates some problematic callback latency with WiFi enabled. NimBLE is also pinned to core 1 - the same core as MicroPython - when using IDF >=4.2.
This commit is contained in:
parent
63438a31bb
commit
357078504d
|
@ -18,12 +18,22 @@ if(NOT EXISTS ${MICROPY_BOARD_DIR}/mpconfigboard.cmake)
|
|||
message(FATAL_ERROR "Invalid MICROPY_BOARD specified: ${MICROPY_BOARD}")
|
||||
endif()
|
||||
|
||||
# Include main IDF cmake file.
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
# Define the output sdkconfig so it goes in the build directory.
|
||||
set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig)
|
||||
|
||||
# Include board config; this is expected to set SDKCONFIG_DEFAULTS (among other options).
|
||||
include(${MICROPY_BOARD_DIR}/mpconfigboard.cmake)
|
||||
|
||||
# Add sdkconfig fragments that depend on the IDF version.
|
||||
if(IDF_VERSION_MAJOR EQUAL 4 AND IDF_VERSION_MINOR LESS 2)
|
||||
set(SDKCONFIG_DEFAULTS ${SDKCONFIG_DEFAULTS} boards/sdkconfig.nimble_core0)
|
||||
else()
|
||||
set(SDKCONFIG_DEFAULTS ${SDKCONFIG_DEFAULTS} boards/sdkconfig.nimble_core1)
|
||||
endif()
|
||||
|
||||
# Concatenate all sdkconfig files into a combined one for the IDF to use.
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/sdkconfig.combined.in "")
|
||||
foreach(SDKCONFIG_DEFAULT ${SDKCONFIG_DEFAULTS})
|
||||
|
@ -33,6 +43,5 @@ endforeach()
|
|||
configure_file(${CMAKE_BINARY_DIR}/sdkconfig.combined.in ${CMAKE_BINARY_DIR}/sdkconfig.combined COPYONLY)
|
||||
set(SDKCONFIG_DEFAULTS ${CMAKE_BINARY_DIR}/sdkconfig.combined)
|
||||
|
||||
# Include main IDF cmake file and define the project.
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
# Define the project.
|
||||
project(micropython)
|
||||
|
|
|
@ -7,11 +7,3 @@ CONFIG_BTDM_CTRL_MODE_BTDM=
|
|||
CONFIG_BT_NIMBLE_ENABLED=y
|
||||
|
||||
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4
|
||||
|
||||
# Pin to the same core as MP.
|
||||
# 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
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# For 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
|
|
@ -0,0 +1,6 @@
|
|||
# For IDF >=4.2, we are able to put NimBLE on core 1, and for synchronisation
|
||||
# with the ringbuffer and scheduler MP needs to be on the same core.
|
||||
# MP on core 1 prevents interference with WiFi for time sensitive operations.
|
||||
CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=n
|
||||
CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y
|
||||
CONFIG_BT_NIMBLE_PINNED_TO_CORE=1
|
|
@ -38,10 +38,15 @@
|
|||
#define MICROPY_PLATFORM_VERSION "IDF" IDF_VER
|
||||
|
||||
// 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
|
||||
// Now that we have IDF 4.2.0+, we are once again able to pin to core 1
|
||||
// and avoid the Wifi/BLE timing problems on the same core.
|
||||
// Best effort here to remain backwards compatible in rare version edge cases...
|
||||
// See https://github.com/micropython/micropython/issues/5489 for history
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
|
||||
#define MP_TASK_COREID (1)
|
||||
#else
|
||||
#define MP_TASK_COREID (0)
|
||||
#endif
|
||||
|
||||
extern TaskHandle_t mp_main_task_handle;
|
||||
|
||||
|
|
Loading…
Reference in New Issue