Semaphore is taken at beginning

mc78 wrote on Wednesday, November 27, 2019:

-uVision 5.28
-FreeRTOS 10.10 (Basic API in use not CMSYS OS API)
Our project is programmed in C. The project has a modular structure. This means that a task (T1) runs and calls functions in several modules. One of these modules (A) has a semaphore to protect a memory area. This memory area is called by another function (b()) from another module (B) by the task (T1) and should write the memory when it gets the semaphores. The function (a()) of module (A) called after function (b()) by task (T1) should copy the same memory area to another area if the semaphore is available. At the very first call of the functions b() and a()) the semaphore is occupied although nobody has taken the semaphore and the semaphore is set free during initialization. After that the process works. Maybe you already had such problems? Possibly a timing or priority problem?