echel0n wrote on Thursday, February 19, 2009:
I’ve been successfull on getting data from uart1 then transfering it to my uIP task via xQueue and out through my ethernet port to my server and then receiving the response from the server back into my uIP task and then xQueue’d to my uart task but thats as far as I’ve gotten.
I’ve tried sending the data in the xQueue out to uart1 but it seems to be having issues. Could someone please look at my code and tell me whats wrong. The array of data that my xQueue variable holds is the exact hex I wanted so thats fine but it seems once I execute my uart1write function that it goes all to hell.
[code]
xIKSServerMessage xSMessage;
if(xIKSServerQueue != 0)
{
if( xQueueReceive( xIKSServerQueue, &xSMessage, ( portTickType ) 10 ) != pdFAIL )
{
int i;
for(i=0; xSMessage.data[i] !=0; i++) {
uart1PutChar(xSMessage.data[i], xBlockTime);
}
}
}
signed portBASE_TYPE uart1PutChar (signed portCHAR cOutChar, portTickType xBlockTime)
{
signed portBASE_TYPE xReturn = 0;
char ch;
ch = cOutChar;
portENTER_CRITICAL ();
{
//
// Is there space to write directly to the UART?
//
if (*plTHREEmpty1 == (portLONG) pdTRUE)
{
*plTHREEmpty1 = pdFALSE;
U1THR = ch;
xReturn = pdPASS;
}
else
{
//
// We cannot write directly to the UART, so queue the character. Block for a maximum of
// xBlockTime if there is no space in the queue.
//
xReturn = xQueueSend (xTX1Queue, &cOutChar, xBlockTime);
//
// Depending on queue sizing and task prioritisation: While we were blocked waiting to post
// interrupts were not disabled. It is possible that the serial ISR has emptied the Tx queue,
// in which case we need to start the Tx off again.
//
if ((*plTHREEmpty1 == (portLONG) pdTRUE) && (xReturn == pdPASS))
{
xQueueReceive (xTX1Queue, &cOutChar, serNO_BLOCK);
*plTHREEmpty1 = pdFALSE;
U1THR = cOutChar;
}
}
}
portEXIT_CRITICAL ();
return xReturn;
}
[/code]