This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Error while Serial Programming for TMS320F28027

dEAR

i HAD MADE changes to existing Sci_Echoback.c example project

msg = "\r\n\n\nHello World!\0";
scia_msg(msg);

msg = "\r\nYou will enter a character, and the DSP will echo it back! \n\0";
scia_msg(msg);
for(;;)
{

msg = "\r\nEnter a character: \0";
// msg = "\r\n ";
scia_msg(msg);

// Wait for inc character

while(SciaRegs.SCIFFRX.bit.RXFFST !=1) { } // wait for XRDY =1 for empty state

// Get character
ReceivedChar = SciaRegs.SCIRXBUF.all;

// Echo character back
msg = "You sent: \0";
scia_msg(msg);
scia_xmit(ReceivedChar);
// adc=(int)(ir_grid*100);
adc=(int)(12.45);
ltoa(adc, msg);
scia_msg(msg);
}

The ouput is shown below

Hello World!
You will enter a character, and the DSP will echo it back!

Enter a character: You sent: A12
Enter a character: 12A12
Enter a character: 12A12
Enter a character: 12A12

Why the number 12 is repeated again and why "You sent" is not displayed 

  • Hi Ashutosh,

    What are you inputing? Are you enabling the FIFO enhancement of the SCI?

    ReceivedChar should only be one character and it seems like multiple characters are being sent.

    I think "while(SciaRegs.SCIFFRX.bit.RXFFST !=1) { }" is wrong. This will exit the while loop when the the Receive FIFO is empty. You should wait in the loop until something is received into the FIFO, and then read it out "ReceivedChar = SciaRegs.SCIRXBUF.all;"

    Try "while(SciaRegs.SCIFFRX.bit.RXFFST !=0) { }"

    Also, I suggest stepping through your code in CCS to see why it is not transmitting what is expected. In order to get the characters to come out of the UART, you will likely have to free run your project, but you can set breakpoints strategically.

    Let me know if this helps and if you have any more questions.

    Best Regards,
    sal