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.

TMS320F2800157: SCI transmitting and receiving problem.

Part Number: TMS320F2800157
Other Parts Discussed in Thread: SYSCONFIG

Hello everyone,

I am using TMS320F2800157 LaunchPad microcontroller. 

When transmitting or receiving data between a laptop (with FTDI Serial to USB Cable) and a microcontroller using the SCI (UART) protocol, I utilize the sci_ex2_loopback_interrupts and sci_ex3_echoback code.

However, despite attempts to switch from loopback mode to non-loopback mode, the system persists in operating solely in loopback mode. During testing, I've observed that the SCIA port on the LaunchPad is not showing any data on the GPIO 28 and 29. But the registers show the incoming and outgoing data. 

Then we tried SCIB, which is operational but it suffers from the loss of the last 2 bytes of transmitted data. Although, the missing two bytes comes with the second set of transmitted data.  Additionally, the data isn't appearing on Putty (or any other software), but it is being received by the logic analyzer.


Can someone help us to find out the reason why the last two bytes of the TX is missing?


Regards,

Siva Kumar 

  • Hi Siva,

    Could you share your configuration code for the case where the last two bytes aren't being received?

    Thank you,

    Luke

  • We are using CCS 12.7 and C2000 5.2 examples.

    We used sysConfig file to initialize the SCIB.

    This is our main.c

    #include "driverlib.h"
    #include "device.h"
    #include "board.h"
    #include "c2000ware_libraries.h"
    
    // Main
    //
    void main(void)
    {
    
        //
        // Initialize device clock and peripherals
        //
        Device_init();
    
        //
        // Disable pin locks and enable internal pull-ups.
        //
        Device_initGPIO();
    
        //
        // Initialize PIE and clear PIE registers. Disables CPU interrupts.
        //
        Interrupt_initModule();
    
        //
        // Initialize the PIE vector table with pointers to the shell Interrupt
        // Service Routines (ISR).
        //
        Interrupt_initVectorTable();
    
        //
        // PinMux and Peripheral Initialization
        //
        Board_init();
    
        //
        // C2000Ware Library initialization
        //
        C2000Ware_libraries_init();
    
        //
        // Enable Global Interrupt (INTM) and real time interrupt (DBGM)
        //
        EINT;
        ERTM;
    
        uint16_t loopCounter = 0;
        uint16_t receivedChar;
        unsigned char *msg;
        uint16_t rxStatus = 0U;
    
        msg = "\r\n\n\nHello World!\0";
        SCI_writeCharArray(mySCI0_BASE, (uint16_t*)msg, 17);
        msg = "\r\nYou will enter a character, and the DSP will echo it back!\n\0";
        SCI_writeCharArray(mySCI0_BASE, (uint16_t*)msg, 62);
    
        //
        // Loop Forever
        //
        for(;;)
        {
            msg = "\r\nEnter a character: \0";
            SCI_writeCharArray(mySCI0_BASE, (uint16_t*)msg, 22);
    
            //
            // Read a character from the FIFO.
            //
            receivedChar = SCI_readCharBlockingFIFO(mySCI0_BASE);
    
            rxStatus = SCI_getRxStatus(mySCI0_BASE);
            if((rxStatus & SCI_RXSTATUS_ERROR) != 0)
            {
                //
                //If Execution stops here there is some error
                //Analyze SCI_getRxStatus() API return value
                //
                ESTOP0;
            }
    
            //
            // Echo back the character.
            //
            msg = "  You sent: \0";
            SCI_writeCharArray(mySCI0_BASE, (uint16_t*)msg, 13);
            SCI_writeCharBlockingFIFO(mySCI0_BASE, receivedChar);
    
            //
            // Increment the loop count variable.
            //
            loopCounter++;
    
        }
    }
    
    //
    // End of File
    //

  • First TX packet.

    Excepted output :  "\r\n\n\nHello World!\0"

    what we got :  "\r\n\n\nHello World"

    Second TX packet

    Excepted output :  "\r\nYou will enter a character, and the DSP will echo it back!\n\0"

    what we got :  "!\0\r\nYou will enter a character, and the DSP will echo it back!"

    we are missing last 2 bytes from the 1st packet 

    On second Tx we get the missing 2bytes, then the rest of the second packet. Also the last 2bytes of packet are missing, which we get on 3rd TX. and this pattern continues.

  • Hi Siva,

    I suspect this issue may be due to an overflow of the SCI TX buffer. Could you test this with a message less than 16 bytes long? Are the last two bytes still missing? Do you see this issue in FIFO and non-FIFO mode?

    Thank you,

    Luke

  • Yes, we tested with 10 bytes and still getting two missing byte at the end. We see this issue with non-FIFO mode.

    When we enable FIFO then, more bytes are missing.

    We don't know how to configure the FIFO size as we are using sysConfig to enable the communication protocols.

  • Hi Sheershak,

    Are you testing with a launchpad or control card or custom board? I can test the issue on my side to determine the root cause.

    Thank you,

    Luke

  • Hi Luke,

    We are using launchpad for testing.

    Thank you,

     Siva Kumar

  • Hi Siva,

    I am able to run sci_ex3_echoback without any issues. It seems you have created a version of this example that uses SysConfig. Can you confirm that the imported version of the project works when you do not add any modifications to the code? Are you using the CCS COM port for testing?

    Are you setting breakpoints when you observe this issue? Breakpoints will cause the SCI to stop mid transmission by default so some of the message may be getting cut off.

    Thank you,

    Luke