I use few tasks with the same priority. I have 2 almost identical tasks that transmits to the UART1 and UART3 ( Task per UART channel) the 2 tasks starts together and after a while one of the tasks stops transmiting. when stoping the run (in debug mode) the task state is Ready (in the MQX Task Summary) . while other tasks with the same priority work fine.
here is the task list:
TASK_TEMPLATE_STRUCT MQX_template_list[] = { /* Task number, Entry point, Stack, Pri, String, Auto? */ {MAIN_TASK, Main_task, 2000, 12, "Main", MQX_AUTO_START_TASK }, {MANAGER_TASK, Mngr_ManagerTask, 2000, 11, "Manager", 0 }, {AGENT_TASK, Agnt_Task, 2000, 11, "Agent", 0 }, {SEND1_TASK, Mngr_Send1Task, 2000, 10, "Send1", 0 }, {SEND3_TASK, Mngr_Send3Task, 2000, 10, "Send3", 0 }, {CYCLIC_TASK1, Mngr_CyclicTask1, 2000, 11, "Cyclic1", 0 }, {CYCLIC_TASK3, Mngr_CyclicTask3, 2000, 11, "Cyclic3", 0 }, {NULL_TASK, 0, 0, 0, 0, 0, }};
here is problematic task:
void Mngr_CyclicTask3(uint_32 initial_data){ uint_8 m_commBuf[UART_HANDLE],m_length,index; _time_delay(500); // send message to UART3 index = params.Uart3Handle; GET_HANDLE_PARAMS; while(1) { //wait for the writing procedure _lwsem_wait(&uart.Write3_SEM); //send buffer Mngr_Write3(m_commBuf,m_length); // signal writing procedure if (!_lwsem_poll(&uart.TX3_SEM)) _lwsem_post(&uart.TX3_SEM); // wait for answer _lwsem_wait_ticks(&uart.Read3_SEM,50); // free resource _lwsem_post(&uart.Write3_SEM); _time_delay(100); }}
Please Advise,
Michael David.