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.

TMS570LS1227: SCI2 of TMS570LS1227 can not transmit data correctly

Part Number: TMS570LS1227
Other Parts Discussed in Thread: HALCOGEN

Hello everyone, I am using the TMS570LS1227's two-Channel SCI interface to send data at the same time. The SCI/LIN transmission data is normal, but another single SCI interface is not sent properly, and its TX pin is always low! Anyone who can answer this question? thank you very much!

The following is my code and the contents of the relevant registers after initialization is completed.

 

void sciInit(void)

{

   /** @b intalise @b SCI1 */

   /** - bring SCI out of reset */

   sciREG1->GCR0 = 1U;

        

   /** - Disable all interrupts */

   sciREG1->CLRINT   = 0xFFFFFFFF;

   sciREG1->CLRINTLVL = 0xFFFFFFFF;

 

   /** - global control 1 */

   sciREG1->GCR1 = (1 << 25) /* enable transmit */

                 | (1 << 24) /* enable receive */

                 | (1 << 5)   /* internal clock (device has no clock pin) */

                 | (0 << 4)   /* number of stop bits */

                 | (0 << 3)   /* even parity, otherwise odd */

                 | (0 << 2)   /* enable parity */

                 | (1 << 1)   /* asynchronous timing mode */

                 | (0 << 0);

                  

   sciREG1->GCR1 = 0x03000022;

   /** - set baudrate */

   sciREG1->BAUD = 259;     /* 19.2KHz, baudrate */

  

   /** - tranmision length */

   sciREG1->LENGTH = 7; /* length is 7+1 */

 

   /** - set SCI pins functional mode */

   sciREG1->FUN = (1 << 2) /* tx pin */

                 | (1 << 1) /* rx pin */

                 | (0); /* clk pin */

                                    

   /** - set SCI pins default output value */

   sciREG1->DOUT = (0 << 2) /* tx pin */

                 | (0 << 1) /* rx pin */

                 | (0); /* clk pin */

 

   /** - set SCI pins output direction */

   sciREG1->DIR = (0 << 2) /* tx pin */

                 | (0 << 1) /* rx pin */

                 | (0); /* clk pin */

 

   /** - set SCI pins open drain enable */

   sciREG1->ODR = (0 << 2) /* tx pin */

                 | (0 << 1) /* rx pin */

                 | (0); /* clk pin */

 

   /** - set SCI pins pullup/pulldown enable */

   sciREG1->PD = (0 << 2) /* tx pin */

               | (0 << 1) /* rx pin */

               | (0); /* clk pin */

 

   /** - set SCI pins pullup/pulldown select */

   sciREG1->PSL = (1 << 2) /* tx pin */

                 | (1 << 1) /* rx pin */

                 | (1); /* clk pin */

 

   /** - set interrupt level */

   sciREG1->SETINTLVL = (0 << 26) /* Framing error */

                       | (0 << 25) /* Overrun error */

                       | (0 << 24) /* Pariry error */

                       | (0 << 9)   /* Receive */

                       | (0 << 8)   /* Transmit */

                       | (0 << 1)   /* Wakeup */

                       | (0);       /* Break detect */

 

   /** - set interrupt enable */

   sciREG1->SETINT = (0 << 26) /* Framing error */

                   | (0 << 25) /* Overrun error */

                   | (0 << 24) /* Pariry error */

                   | (1 << 9)   /* Receive */

                   | (0 << 1)   /* Wakeup */

                   | (0); /* Break detect */

 

   /** - set interrupt enable */

   sciREG1->CLRINT = (0 << 26) /* Framing error */

                   | (0 << 25) /* Overrun error */

                   | (0 << 24) /* Pariry error */

                   | (0 << 9) /* Receive */

                   | (0 << 1) /* Wakeup */

                   | (0); /* Break detect */

 

 

   /** - inialise global transfer variables */

   // g_sciTransfer[0].mode   = 0 << 8;

   // g_sciTransfer[0].length = 0;

 

   /** - Finaly start SCI1 */

   sciREG1->GCR1 |= 0x80;

                                    

         /** @b intalise @b SCI2 */      

   /** - bring SCI out of reset */

        

   sciREG2->GCR0 = 1U;

                  

   /** - Disable all interrupts */

   sciREG2->CLRINT   = 0xFFFFFFFF;

   sciREG2->CLRINTLVL = 0xFFFFFFFF;

                                    

         tmp_reg = sciREG2->DIN;

 

   /** - global control 1 */

   sciREG2->GCR1 = (1 << 25) /* enable transmit */

                 | (1 << 24) /* enable receive */

                 | (1 << 5)   /* internal clock (device has no clock pin) */

                 | (0 << 4)   /* number of stop bits */

                 | (0 << 3)   /* even parity, otherwise odd */

                 | (0 << 2)   /* enable parity */

                 | (1 << 1)   /* asynchronous timing mode */

                 | (0 << 0);

                  

   sciREG2->GCR1 = 0x03000022;

   /** - set baudrate */

   sciREG2->BAUD = 259;     /* 19.2KHz, baudrate */

  

   /** - tranmision length */

   sciREG2->LENGTH = 7; /* length is 7+1 */

                                    

         /** - set SCI pins functional mode */

   sciREG2->FUN = (1 << 2) /* tx pin */

                 | (1 << 1) /* rx pin */

                 | (0); /* clk pin */

                                    

   /** - set SCI pins default output value */

   sciREG2->DOUT = (0 << 2) /* tx pin */

                 | (0 << 1) /* rx pin */

                 | (0); /* clk pin */

   /** - set SCI pins output direction */

   sciREG2->DIR = (0 << 2) /* tx pin */

                 | (0 << 1) /* rx pin */

                 | (0); /* clk pin */

 

   /** - set SCI pins open drain enable */

   sciREG2->ODR = (0 << 2) /* tx pin */

                 | (0 << 1) /* rx pin */

                 | (0); /* clk pin */

                                    

         /** - set SCI pins pullup/pulldown enable */

   sciREG2->PD = (0 << 2) /* tx pin */

               | (0 << 1) /* rx pin */

               | (0); /* clk pin */

 

   /** - set SCI pins pullup/pulldown select */

   sciREG2->PSL = (1 << 2) /* tx pin */

                 | (1 << 1) /* rx pin */

                 | (1); /* clk pin */

                                    

   /** - set interrupt level */

   sciREG2->SETINTLVL = (0 << 26) /* Framing error */

                       | (0 << 25) /* Overrun error */

                       | (0 << 24) /* Pariry error */

                       | (0 << 9)   /* Receive */

                       | (0 << 8)   /* Transmit */

                       | (0 << 1)   /* Wakeup */

                       | (0);       /* Break detect */

 

   /** - set interrupt enable */

   sciREG2->SETINT = (0 << 26) /* Framing error */

                   | (0 << 25) /* Overrun error */

                   | (0 << 24) /* Pariry error */

                   | (1 << 9)   /* Receive */

                   | (0 << 1)   /* Wakeup */

                   | (0); /* Break detect */

 

   /** - set interrupt enable */

   sciREG2->CLRINT = (0 << 26) /* Framing error */

                   | (0 << 25) /* Overrun error */

                   | (0 << 24) /* Pariry error */

                   | (0 << 9) /* Receive */

                   | (0 << 1) /* Wakeup */

                   | (0); /* Break detect */

 

   /** - inialise global transfer variables */

   // g_sciTransfer[0].mode   = 0 << 8;

   // g_sciTransfer[0].length = 0;

         tmp_reg = sciREG2->DIN;

   /** - Finaly start SCI2 */

   sciREG2->GCR1 |= 0x80;

}

  • Hello,
    Did you use HALCoGen to configure SCI ports?

    Best regards,
    Miro
  • thank you for your reply!

    I didn't use HALCoGen to configure the SCI port. Just refer to a routine of the official website, this routine was developed for TMS570LS31x, including the initialization of two SCI interfaces.

    Now he SCI/LIN transmission data is normal, but another single SCI interface is not sent properly, and its TX pin is always low! After the configuration is completed, the value of the DIN register in the above picture reflects the difference in the TX pin values of the two channels.

    In my program, the same configuration is used for the sci interfaces of the two channels, and the same connection method is also used on the hardware! What is the difference between these two channels?

  • Hello,
    I recommend you to use HALCoGen for configuring MCU.
    What I can see on above code is that transfer variables are not initialized.You have comment them. May be you are doing this later.
    Also, please put modules in Reset first and after that bring it out of reset:
    sciREG->GCR0 = 0U;
    sciREG->GCR0 = 1U;

    Best regards,
    Miro
  • Thank you very much for your reply!
    According to your suggestion, I added the following code:

    sciREG->GCR0 = 0U;

    Unfortunately, the problem is still not solved.I use HALCoGen for configuring the sci interface of MCU,Code generated by the HALCoGen tool also can't work correctly!

    According to my experience the transfer variables are not initialized does not affect the level state of the SCITX pin!
    The following is part of my schematic:

    This SCITX and SCIRX defaults to the pull-down state. After my configuration SCIRX goes high, but I don't know why, the SCITX is always low!

    Have you debugged this SCI interface which is not multiplexed with LIN ?

  • Hello,

    Did you enable SCI checkbox in HALCoGen->PINMUX Tab?

    About Reset Pull State:

    Best regards,

    Miro

  • Hello,
    Miro

    According to your suggestion,I enable SCI checkbox in HALCoGen->PINMUX Tab,the SCI interface Working normally!
    Thanks again!

    Best regards,
    lance