diff --git a/nimble/host/mesh/src/adv.c b/nimble/host/mesh/src/adv.c index 2742116ba..b4050f136 100644 --- a/nimble/host/mesh/src/adv.c +++ b/nimble/host/mesh/src/adv.c @@ -17,6 +17,7 @@ #include "host/ble_gap.h" #include "nimble/hci_common.h" #include "mesh/porting.h" +#include "nimble/nimble_port.h" #include "adv.h" #include "net.h" @@ -325,8 +326,8 @@ void bt_mesh_adv_init(void) MYNEWT_VAL(BLE_MESH_ADV_TASK_PRIO), OS_WAIT_FOREVER, g_blemesh_stack, ADV_STACK_SIZE); #else - xTaskCreate(mesh_adv_thread, "mesh_adv", 2768, - NULL, (configMAX_PRIORITIES - 4), &adv_task_h); + xTaskCreatePinnedToCore(mesh_adv_thread, "mesh_adv", 2768, + NULL, (configMAX_PRIORITIES - 5), &adv_task_h, NIMBLE_CORE); #endif /* For BT5 controllers we can have fast advertising interval */ diff --git a/porting/nimble/include/nimble/nimble_port.h b/porting/nimble/include/nimble/nimble_port.h index 28065cf8e..88511381a 100644 --- a/porting/nimble/include/nimble/nimble_port.h +++ b/porting/nimble/include/nimble/nimble_port.h @@ -22,6 +22,8 @@ #include "nimble/nimble_npl.h" +#define NIMBLE_CORE (CONFIG_NIMBLE_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_NIMBLE_PINNED_TO_CORE : tskNO_AFFINITY) + #ifdef __cplusplus extern "C" { #endif diff --git a/porting/npl/freertos/src/nimble_port_freertos.c b/porting/npl/freertos/src/nimble_port_freertos.c index 583a0319d..a8b50ea13 100644 --- a/porting/npl/freertos/src/nimble_port_freertos.c +++ b/porting/npl/freertos/src/nimble_port_freertos.c @@ -46,6 +46,6 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn) * have separate task for NimBLE host, but since something needs to handle * default queue it is just easier to make separate task which does this. */ - xTaskCreate(host_task_fn, "ble", 2048+400, - NULL, (configMAX_PRIORITIES - 3), &host_task_h); + xTaskCreatePinnedToCore(host_task_fn, "ble", 4096, + NULL, (configMAX_PRIORITIES - 4), &host_task_h, NIMBLE_CORE); }