Hi Mac,
Thank you very much for the reply.
The application is a custom board used for receiving UART Data from a zigbee module.
We have had the code running without any issues previously but recently we had to change the ITTYF Queue Buffer size to 2048 bytes in BSP.
But the "Task Queue Blocked" error is coming from a task that extensively uses PRINTF function and the ITTYB which is used for printf uses 256 bytes Queue Buffer size. The Code works for about 24 hours before it goes to "Task Queue Blocked" state and hangs there at serlint.c which calls taskq.c. I have indicated the line of code where it hangs too
/*FUNCTION****************************************************************
*
* Function Name : _io_serial_int_putc_internal
* Returned Value : void
* Comments :
* This function writes out the character to the device if the queue
* is empty, or it writes it to the device. If the queue is full, this
* function will suspend the writing task.
*
*END*********************************************************************/
boolean _io_serial_int_putc_internal
(
/* [IN] the interrupt io device information */
IO_SERIAL_INT_DEVICE_STRUCT_PTR int_io_dev_ptr,
/* [IN] the character to print out */
char c,
_mqx_uint flags
)
{ /* Body */
volatile CHARQ_STRUCT _PTR_ out_queue;
/* Start CR 388 */
#if (PSP_MEMORY_ADDRESSING_CAPABILITY > 8 )
c &= 0xFF;
#endif
/* End CR 388 */
out_queue = int_io_dev_ptr->OUT_QUEUE;
_int_disable();
if(flags & IO_SERIAL_NON_BLOCKING) {
if (_CHARQ_FULL(out_queue)) {
_int_enable();
return FALSE;
} /* Endif */
} else {
if(int_io_dev_ptr->HAVE_STOPPED_OUTPUT) {
_taskq_suspend(int_io_dev_ptr->OUT_WAITING_TASKS);
} /* Endif */
while (_CHARQ_FULL(out_queue)) {
/* Lets wait */
_taskq_suspend(int_io_dev_ptr->OUT_WAITING_TASKS); //HANGS HERE
} /* Endif */
} /* Endif */
if (int_io_dev_ptr->OUTPUT_ENABLED || int_io_dev_ptr->HAVE_STOPPED_OUTPUT) {
_CHARQ_ENQUEUE(out_queue,c);
} else {
int_io_dev_ptr->OUTPUT_ENABLED = TRUE;
(*int_io_dev_ptr->DEV_PUTC)(int_io_dev_ptr, c);
} /* Endif */
_int_enable();
return TRUE;
} /* Endbody */
and in taskq.c it returns
_mqx_uint _taskq_suspend
(
pointer users_task_queue_ptr
)
{ /* Body */
register KERNEL_DATA_STRUCT_PTR kernel_data;
register TD_STRUCT_PTR td_ptr;
register TASK_QUEUE_STRUCT_PTR task_queue_ptr = (TASK_QUEUE_STRUCT_PTR) users_task_queue_ptr;
_GET_KERNEL_DATA(kernel_data);
_KLOGE2(KLOG_taskq_suspend, users_task_queue_ptr);
#if MQX_CHECK_ERRORS
if (task_queue_ptr == NULL) {
_KLOGX2(KLOG_taskq_suspend, MQX_INVALID_PARAMETER);
return(MQX_INVALID_PARAMETER);
} /* Endif */
if (kernel_data->IN_ISR) {
_KLOGX2(KLOG_taskq_suspend, MQX_CANNOT_CALL_FUNCTION_FROM_ISR);
return(MQX_CANNOT_CALL_FUNCTION_FROM_ISR); // this is returned to function _io_serial_int_putc_internal
}/* Endif */
#endif
td_ptr = kernel_data->ACTIVE_PTR;
_INT_DISABLE();
#if MQX_CHECK_VALIDITY
if (task_queue_ptr->VALID != TASK_QUEUE_VALID) {
_int_enable();
_KLOGX2(KLOG_taskq_suspend, MQX_INVALID_TASK_QUEUE);
return(MQX_INVALID_TASK_QUEUE);
} /* Endif */
#endif
td_ptr->STATE = TASK_QUEUE_BLOCKED;
_QUEUE_UNLINK(td_ptr); /* Remove task from ready to run queue */
td_ptr->INFO = (_mqx_uint) & task_queue_ptr->TD_QUEUE;
if (task_queue_ptr->POLICY & MQX_TASK_QUEUE_BY_PRIORITY) {
_sched_insert_priorityq_internal(&task_queue_ptr->TD_QUEUE, td_ptr);
}
else {
_QUEUE_ENQUEUE(&task_queue_ptr->TD_QUEUE, td_ptr);
} /* Endif */
_sched_execute_scheduler_internal(); /* Let the other tasks run */
_INT_ENABLE();
_KLOGX2(KLOG_taskq_suspend, MQX_OK);
return (MQX_OK);
} /* Endbody */
Vinod