I'm giving a binary semaphore from task1 to task2. If task1 receives the correct string from UART, that is when it gives the binary semaphore to task2. Task2 will read data from an ADC and send it via the UART to the PC.
The problem is that on the first run or after every reset of the microcontroller Task2 automatically writes to the UART without task1 giving it the semaphore.
Is this a generic problem that the task can take the semaphore on the first startup of the program?
Are there any work arounds for this?
My code is quite large I think, so thats why I don't post it right now. If there are no general solutions to this I will try and strip the code to a simple one which still exhibits this error.
Please see the reply to this question:
Thank you very much for the fast help!
This has solved my problem!
I was using vSemaphoreCreateBinary(); and I only had to change it to xSemaphoreCreateBinary(); to solve the problem.