cancel
Showing results for 
Search instead for 
Did you mean: 

loopback problem

alex_bauer80
Associate II
Posted on September 08, 2008 at 10:13

loopback problem

1 REPLY 1
alex_bauer80
Associate II
Posted on September 08, 2008 at 10:13

Hello everybody,

I have a problem concerning the Loopback function of the UART1 of the Str71. If I enable this function I cannot receive data (from an external device) anymore.

If I disable it the reception of data works properly.

Please have a look at the sample code below.

Thank you

Jojo

uart1.disableLoopBack( false);// if this is set to ''true'' I get a timeout in the receiveData function (see below)

uart1.enableSmartCardInterface();

uart1.clearRxBuffer();

uart1.clearTxBuffer();

uart1.enableReceiver( true );

uart1.enableFifos( true );

uart1.setGuardTime( 2 );

uart1.setBaudRate( 9600 );

uart1.setEvenParity();

uart1.setStopBits( STOP_BITS_1_5 );

uart1.setDataMode( MODE_8BIT_DATA_PARITY );

uart1.enableUart();

uart1.clearRxBuffer();

reset();//triggers the data sending to the microcontroller

uart1.clearRxBuffer();

lengthATRTable=ATRLENGTH;

if(!receiveData(atrTable, &lengthATRTable, TIMEOUT))

[...]

bool receiveData(unsigned char *recBuffer, unsigned long *lengthRecBuffer, const unsigned long timeout)

{

unsigned long timeoutCounter=0;

unsigned long recCounter=0;

uart1.enableReceiver(true);

while((!(uart1.isRxBufferNotEmpty()))&&(timeoutCounter

{

timeoutCounter++;

}

if(timeoutCounter

{

for(long i=0;i

if(uart1.receiveByte(&recChar, 0xff))

{

recBuffer[recCounter]=(unsigned char) recChar;

recCounter++;

}

}

(*lengthRecBuffer)=recCounter;

return true;

}

[....]

}