xSemaphoreTake timeout issues

Hi folks,
The hw platform is a STM32H7.
In this system I’m making extensive use of the DMA2D peripheral (it’s a simple 2D graphics engine) from multiple FreeRTOS tasks.

I am attempting to share the DMA2D peripheral by using a xSemaphoreCreateBinaryStatic().
xSemaphoreTake() when a task attempts to use the peripheral, and is xSemaphoreGiveFromISR() in the DMA2D interrupt when the operation is complete.

At the moment the two tasks using the peripheral have the same priority.
One task uses the peripheral about 10 times a second, the other only a couple of times a second.
The peripheral only takes a max of 10mS to complete (taking the semaphore, to giving it).

For some reason though xSemaphoreTake(DMA2DSemaphore, pdMS_TO_TICKS(500)) is frequently timing out.
I cannot work out why as the DMA2D peripheral is only busy about 15% of the time.

The system is 80% idle, and tick speed is the default 1000Hz.

Does anyone know what the problem may be here, or how i should go about debugging the problem?

Thanks in advance!

Can you share the code? Since all transactions are initiated by the tasks themselves, the visible behavior will naturally depend on the control flow imposed by the tasks. Also, did you make sure that the semaphore is initially free so that the first tasks can “kick off” the engine?

The problem has been resolved.
xSemaphoreGiveFromISR() wasn’t always being called when it should have been.