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.

TMS320F28377D: SCI communication between two 77D microcontrollers

Part Number: TMS320F28377D

Hi All,

I am working with two 77D microcontrollers and I'm trying to use the SCI peripheral to transfer data.  I have tested both in loopback and they seem to be working, but when I try to get them to communicate with each other they seem to be sampling each character multiple times. I am using interrupts to send and receive, and idle-line mode.

Example: 77D#1 sends 'r' and 'q' using interrupts...77D#2 receives several r's and several q's....77D#2 responds by sending '0x0095' ,'0x0086', '0x0064', and '0x0031'...77D#1 receives scrambled data like '0x00C5', 0x00C5', '0x00C5', '0x00C5', and a few '0x00FF's and '0x00F5'

I have turned off loopback and checked that the baud rate is the same.

Does anyone have any suggestions as to why this might be happening.

 

  • David,

         I don't know of anything related to the module itself, or the hardware, that would be causing the device to send repeat messages. I expect this to be related to application code.

    1. Have you connected the grounds between the devices?
    2. Are you seeing any RX errors?

    Regards,

    Cody

  • 1. Yes, the two devices are grounded together.

    2. No, I have not received any RX errors that I have notices...I check before taking the data from the buffer in the RX interrupt.

    Here is the sci_init and ISRs

    //
    // sciaTxFifoIsr - SCIA Transmit FIFO ISR
    //
    interrupt void sciaTxFifoIsr(void)
    {
    unsigned int i = 0;

    for(; i<4; i++)
    {
    SciaRegs.SCITXBUF.all=ADCdata[i]; // Send data
    }

    TXRDY_flag = 0;

    PieCtrlRegs.PIEIER9.bit.INTx1 = 1; // PIE Group 9, INT1 - RX INT

    SciaRegs.SCIFFTX.bit.TXFFINTCLR=1; // Clear SCI Interrupt flag
    // SciaRegs.SCICTL2.bit.TXINTENA = 0; // Disable TX Interrupt
    PieCtrlRegs.PIEIER9.bit.INTx2 = 0; // PIE Group 9, INT2
    PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ACK
    }

    //
    // sciaRxFifoIsr - SCIA Receive FIFO ISR
    //
    interrupt void sciaRxFifoIsr(void)
    {
    unsigned int i = 0;
    static unsigned int cnt = 0;


    if(SciaRegs.SCIRXBUF.bit.SCIFFFE || SciaRegs.SCIRXBUF.bit.SCIFFPE)
    {
    //error handling here
    i = 6; //to bypass frame read, put a breakpoint here as well for debugging
    }

    for(; i<2;i++)
    {
    rdataA[i] = SciaRegs.SCIRXBUF.bit.SAR; //read entire frame - TRY CHANGING THIS TO THE EXAMPLE METHOD
    }
    RXRCV_flag = 1; //set flag to indicate frame ready
    cnt++;

    SciaRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
    SciaRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag

    PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ack
    }

    //
    // scia_fifo_init - Configure SCIA FIFO
    //
    void scia_fifo_init()
    {
    SciaRegs.SCICCR.all = 0x0007; // 1 stop bit, No loopback
    // No parity,8 char bits,
    // async mode, idle-line protocol
    SciaRegs.SCICTL1.all = 0x0003; // enable TX, RX, internal SCICLK,
    // Disable RX ERR, SLEEP, TXWAKE
    SciaRegs.SCICTL2.bit.TXINTENA = 1;
    SciaRegs.SCICTL2.bit.RXBKINTENA = 1;
    SciaRegs.SCIHBAUD.all = 0x0000;
    SciaRegs.SCILBAUD.all = SCI_PRD;
    SciaRegs.SCIFFTX.all = 0xC022;
    SciaRegs.SCIFFRX.bit.RXFIFORESET = 0; //rst fifo
    SciaRegs.SCIFFRX.all = 0x0021;
    SciaRegs.SCIFFRX.bit.RXFFIL = 1;
    SciaRegs.SCIFFCT.all = 0x00;

    SciaRegs.SCICTL1.all = 0x0023; // Relinquish SCI from Reset
    SciaRegs.SCIFFTX.bit.TXFIFORESET = 1;
    SciaRegs.SCIFFRX.bit.RXFIFORESET = 1;
    }

    //
    // End of file
    //

  • David,

    how have you verified the baud rate? Some good ways are:

    • Check XCLKOUT
    • Read the baud registers at run time
    • Measure the Bit times using an oscilloscope

    Could you observe the Tx of each device using an oscilloscope, by looking at this output you should be able to determine if the problem is on the Tx side or the Rx side.

    Regards,
    Cody

  • I'll give that a try.

    I was looking over the documentation for the SCI peripheral and in the idle-line portion it refers to a CPU device address, can you tell me how to find that for the 77D's.  

    I'm wondering If the issue is that I am not giving an address in the first byte.

  • David,

    what you are referring to is only for the multi-processor mode of the SCI module.

     Are you planning on using point-to-point communication or a multi-processor communication?

    Regards,
    Cody