DSPRelated.com
Forums

problem in intialization of UART(SCIa) of TMS320F28335

Started by sbhu...@rmsindia.com October 10, 2008
Hi. I am using TMS320F28335 starter kit by texas. I am having problem in running of SCI(UART) code example given with software. As according to software example, it is running at 115200 baud rate at 25Mhz clock. But when run the code and check at hyperterminal(hyperterminal is working properly), I found wrong data at the terminal. Also I have checked the code for different baud rates.According to register setting in the code example,it is running at 37.5MHz and also i checked for it by making appropriate changes but its not working. So please help me in finding the solution of it. Thanks

void main(void)
{
int status = 0;

InitSysCtrl();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
XINTF_Init();
CSM_unlock();
InitGpio();
LED_Init();

do
{
// Test:1
if( RUN_TEST(TestFlags,0)) {
SET_TEST_FLAG(TestRan,0);
status |= TEST_execute( TEST_memory, "MEMORY TEST",1, 0);
}

// Test:2
while(1)
{
if( RUN_TEST(TestFlags,1)) {
SET_TEST_FLAG(TestRan,1);
status |= TEST_execute( TEST_SciLoopBack, "SCI LOOPBACK",2, 1);
}
}
// Test:3
if( RUN_TEST(TestFlags,2)) {
SET_TEST_FLAG(TestRan,2);
status |= TEST_execute( TEST_CanLoopBack, "CAN LOOPBACK",3,2);
}

// Test:4
if( RUN_TEST(TestFlags,3)) {
SET_TEST_FLAG(TestRan,3);
status |= TEST_execute( TEST_I2CLoopBack, "I2C LOOPBACK",4, 3);
}
}while(--TestCount > 0);

asm (" ESTOP0");

}
int TEST_SciLoopBack(void)
{
Uint16 SendChar;
volatile Uint16 ReceivedChar;
Uint16 NotSendChar;

int Loop;
long Timeout;
int Xrdy;

scia_reset();
scib_reset();

scia_fifo_init(); // Initialize the SCI FIFO
scib_fifo_init(); // Initialize the SCI FIFO

scia_loopback_init(); // Initalize SCI for digital loop back
scib_loopback_init(); // Initalize SCI for digital loop back

SendChar = 0;

for(Loop=0; Loop<256; Loop++)
{
// Send on A recv on B
scia_xmit(SendChar);
Timeout = MAX_WAIT;
do{

Xrdy = (ScibRegs.SCIFFRX.bit.RXFFST !=1 ) ?0:1; // wait for XRDY =1 for empty state
DELAY_US(BIT_TIME);
}while( ( Timeout-- > 0) && (!Xrdy) );

if( Timeout <= 0 ) {
Error_TxBToRxA = Error_TxAToRxB = (unsigned)-1;
return( -1 );
}

// Check received character
ReceivedChar = ScibRegs.SCIRXBUF.all & 0x00FF;
if(ReceivedChar != SendChar)
Error_TxAToRxB++;

// Send on B recv on A
NotSendChar = ~SendChar;
NotSendChar &= 0x00FF;

scib_xmit(NotSendChar);

Timeout = MAX_WAIT;
do{

Xrdy = (SciaRegs.SCIFFRX.bit.RXFFST !=1 ) ?0:1; // wait for XRDY =1 for empty state
DELAY_US(BIT_TIME);
}while( ( Timeout-- > 0) && (!Xrdy) );

if( Timeout <= 0 ) {
Error_TxAToRxB = Error_TxBToRxA = (unsigned)-3;
return( -3 );
}

// Check received character
ReceivedChar = SciaRegs.SCIRXBUF.all & 0x00FF;
if(ReceivedChar != NotSendChar)
Error_TxBToRxA++;

// Move to the next character and repeat the test
SendChar++;
SendChar &= 0x00FF;

}
if( Error_TxAToRxB != 0 )
return( -2 );

if( Error_TxBToRxA != 0 )
return( -4 );

return( 0 );
}


OMAP35x EVM jump-starts low-power apps
The modular and extensible OMAP35x Evaluation Module (EVM) enables developers to start building applications based on the OMAP35x architecture: http://www.DSPRelated.com/omap35x
We had a similar problem. It turns out that the EzDSP boards that TI sent us were older - and slower. We worked around the problem by doing this in the scia_echoback_init() function:

// #if (CPU_FRQ_150MHZ)
// SciaRegs.SCIHBAUD =0x0001; // 9600 baud @LSPCLK = 37.5MHz.
// SciaRegs.SCILBAUD =0x00E7;
// #endif
// #if (CPU_FRQ_100MHZ)
SciaRegs.SCIHBAUD =0x0001; // 9600 baud @LSPCLK = 20MHz.
SciaRegs.SCILBAUD =0x0044;
// #endif

Hi. I am using TMS320F28335 starter kit by texas. I am having problem in running of SCI(UART) code example given with software. As according to software example, it is running at 115200 baud rate at 25Mhz clock. But when run the code and check at hyperterminal(hyperterminal is working properly), I found wrong data at the terminal. Also I have checked the code for different baud rates.According to register setting in the code example,it is running at 37.5MHz and also i checked for it by making appropriate changes but its not working. So please help me in finding the solution of it. Thanks
>
>void main(void)
>{
> int status = 0;
>
> InitSysCtrl();
> DINT;
> InitPieCtrl();
> IER = 0x0000;
> IFR = 0x0000;
> InitPieVectTable();
> XINTF_Init();
> CSM_unlock();
> InitGpio();
> LED_Init();
>
> do
> {
> // Test:1
> if( RUN_TEST(TestFlags,0)) {
> SET_TEST_FLAG(TestRan,0);
> status |= TEST_execute( TEST_memory, "MEMORY TEST",1, 0);
> }
>
> // Test:2
> while(1)
> {
> if( RUN_TEST(TestFlags,1)) {
> SET_TEST_FLAG(TestRan,1);
> status |= TEST_execute( TEST_SciLoopBack, "SCI LOOPBACK",2, 1);
> }
> }
> // Test:3
> if( RUN_TEST(TestFlags,2)) {
> SET_TEST_FLAG(TestRan,2);
> status |= TEST_execute( TEST_CanLoopBack, "CAN LOOPBACK",3,2);
> }
>
> // Test:4
> if( RUN_TEST(TestFlags,3)) {
> SET_TEST_FLAG(TestRan,3);
> status |= TEST_execute( TEST_I2CLoopBack, "I2C LOOPBACK",4, 3);
> }
> }while(--TestCount > 0);
>
> asm (" ESTOP0");
>
>}
>int TEST_SciLoopBack(void)
>{
> Uint16 SendChar;
> volatile Uint16 ReceivedChar;
> Uint16 NotSendChar;
>
> int Loop;
> long Timeout;
> int Xrdy;
>
> scia_reset();
> scib_reset();
>
> scia_fifo_init(); // Initialize the SCI FIFO
> scib_fifo_init(); // Initialize the SCI FIFO
>
> scia_loopback_init(); // Initalize SCI for digital loop back
> scib_loopback_init(); // Initalize SCI for digital loop back
>
> SendChar = 0;
>
> for(Loop=0; Loop 0) && (!Xrdy) );
>
> if( Timeout 0) && (!Xrdy) );
>
> if( Timeout

_____________________________________