Hi there,
I am struggling to make vTaskDelay work for tasks that are running on the second core (or the one without the tick, see.
This is my minimal example where the FreeRTOS_Config stems 1-to-1 from the pico-examples:
You can see the BlinkTask is pinned to core 1, while the main one is running on core 0.
When POSITION 1 is active, stdout is filled with "BlinkingLED...", the delay is not held and the main task never outputs.
When POSITION 2 is active, the BlinkTask prints once then never again. The main task outputs as expected.
If I move the BlinkTask to core 0 then everything is fine.
I am wondering what is the proper way to share the tick between cores?
I thank you very much already for any tips!
Forgot to mention: platform is a Pico W, SDK v2.1.1
I am struggling to make vTaskDelay work for tasks that are running on the second core (or the one without the tick, see
Code:
config_TICK_COREThis is my minimal example where the FreeRTOS_Config stems 1-to-1 from the pico-examples:
Code:
void blink_task(void* params) { const int32_t value = *reinterpret_cast<int32_t*>(params); while (true) { printf("Blinking LED...%d\n", value); vTaskDelay(1000); }}void main_task(__unused void* params) { // POSITION 1 // int32_t value3 = -5; // xTaskCreateAffinitySet(blink_task, "BlinkTask", 2048, &value3, 1, 2, NULL); int count = 0; while (true) { printf("Hello from main task count=%u\n", count++); vTaskDelay(3000); }}void VLaunch(void) { TaskHandle_t task; xTaskCreateAffinitySet(main_task, "MainThread", 2048, NULL, 1, 1, &task); // POSITION 2 int32_t value3 = -5; xTaskCreateAffinitySet(blink_task, "BlinkTask", 2048, &value3, 1, 2, NULL); /* Start the tasks and timer running. */ vTaskStartScheduler();}/*** * Main * @return */int main(void) { if (!stdio_init_all()) { return 1; } busy_wait_ms(1000); printf("Starting FreeRTOS SMP on both cores...\n"); VLaunch(); return 0;}When POSITION 1 is active, stdout is filled with "BlinkingLED...", the delay is not held and the main task never outputs.
When POSITION 2 is active, the BlinkTask prints once then never again. The main task outputs as expected.
If I move the BlinkTask to core 0 then everything is fine.
I am wondering what is the proper way to share the tick between cores?
I thank you very much already for any tips!
Forgot to mention: platform is a Pico W, SDK v2.1.1
Statistics: Posted by 22sunit — Tue May 20, 2025 1:01 pm — Replies 0 — Views 38