I have a custom board (based on the twrk60n512) where I am using a number of tasks to perform various tasks. The application is configured to use priority based scheduling.
Two of the tasks in particular use the _io_write function to pass data to two individual uart channels,1 uart channel per task.
During testing I have found that the uart transmission (running at 115200 baud) from the lower priority task can have a delay of 15-20ms within the packet, this causes the field device (on customers side) to time out is it believes the transmission has ended. It is worth mentioning that no data is lost just an unexpected delay.
I believe that the lower priory task starts to transmit and is then blocked by the higher priory task which then also
To get around this I am using a lightweight semaphore, I wait for the semaphore before the _io_write and post the semaphore immediately after the fflush function.
write(modbusslave, uc_MSOut, length);
This seems to resolve the problem.
The question I have is there anything additional I should consider when using semaphores? Im new to MQX and am looking for some general advice.
Thanks in advance,