Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freertos mutex and task switching 2 cores version (IDFGH-14654) #15400

Open
3 tasks done
ifedotov1984 opened this issue Feb 15, 2025 · 0 comments
Open
3 tasks done

Freertos mutex and task switching 2 cores version (IDFGH-14654) #15400

ifedotov1984 opened this issue Feb 15, 2025 · 0 comments
Labels
Status: Opened Issue is new

Comments

@ifedotov1984
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

If 2 cores and mutexes are used, a situation arises where on core 1 the highest priority task (which does not use mutexes) is not executed while a task on core 0 is waiting for a mutex.

Attached is a test project with this problem.
If you run it as is, then the task high _1 will be executed after high _0 is executed, although it is on another core and does not wait for the mutex.
2) if increase the priority of high _1 above high _0 (set 12 instead of 9), then the program execution becomes as expected
3) if transfer the task high _1 with priority 9 to core 0, then the program execution becomes as expected
4) if transfer the task low _1 with priority 1 to core 0, then the program execution becomes as expected

Image

mutex_test.zip

I found out that this happens because of FreeRTOS priority inheritance https://www.freertos.org/Documentation/02-Kernel/02-Kernel-features/02-Queues-mutexes-and-semaphores/04-Mutexes.
With one core system, it is clear why this happens.
But with 2 cores, the principle of multiple cores is violated.
It turns out that while the low-priority task is executed on the first core (and takes mutex), the high-priority one (on first core) is not executed, because the high-priority task on the zero core is waiting for a mutex.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 15, 2025
@github-actions github-actions bot changed the title Freertos mutex and task switching 2 cores version Freertos mutex and task switching 2 cores version (IDFGH-14654) Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

No branches or pull requests

2 participants