Using a mutex to access spi from 3 tasks.
Posted: Fri Jul 05, 2024 1:23 pm
Hello all.
I currently have working code that shares the spi bus between a vs1053 and a TFT on 2 different tasks.
Using a SemaphoreHandle_t and xSemaphoreCreateMutex() this works fine.
Now I want to access the spi bus for sdcard access from a third task .
Can I just use xSemaphoreTake(spiMutex, portMAX_DELAY) and xSemaphoreGive(spiMutex) to control the spi access of this third task together with the other tasks?
If so, are there any caveats?
I currently have working code that shares the spi bus between a vs1053 and a TFT on 2 different tasks.
Using a SemaphoreHandle_t and xSemaphoreCreateMutex() this works fine.
Now I want to access the spi bus for sdcard access from a third task .
Can I just use xSemaphoreTake(spiMutex, portMAX_DELAY) and xSemaphoreGive(spiMutex) to control the spi access of this third task together with the other tasks?
If so, are there any caveats?