Tool/software: TI-RTOS
Hi,
I have written uart multi thread program and its code snippet is like this:
void *mainThread(void *arg0)
{
while (1) {
Tx_buffer[0]=0x01;
Tx_buffer[0]=0x02;
Tx_buffer[0]=0x03;
UART_write (uart1, &Tx_buffer, 3); // Sending data to sensor.
}
}
void *Thread2(void *arg0)
{
while (1) {
UART_read (uart1, &Tx_buffer, 1); // receiving data from sensor.
UART_write (uart2, &Tx_buffer, 1); // sending data to external.
}
}
void *Thread3(void *arg0)
{
while (1) {
UART_read (uart3, &Tx_buffer, 1); // receiving data from external.
UART_write (uart1, &Tx_buffer, 1); // sending data to sensor.
}
}
In this i have given higher priority to 'Thread2' and next priority to 'Main_Thread' and least priority to 'Thread3'.
With this Main_Thread & Thread2 functions are executing properly but not Thread3.
If i given higher priority to Thread3 then all three functions are not executing.
Can any one tell me, is the way of writing the code is right?. or should i use mutex or semaphores in between.
Please guide me.
Thank you
Regards
Kalyan.