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.

SCI Receive problem with TMS570LS1224

Hello,

i have a TMS570LS12x Launchpad and want to work with the SCI.

I tested the SCI1 and SCI2, Transmitting data from the TMS works but i can't receive Data.

I hope sombuddy can help me.

The SCI registers after sending some bytes and hardwareloopback:

GlbCtrl0    0x00000001    global control register [Memory Mapped]    
GlbCtrl1    0x030000A2    global control register [Memory Mapped]    
GlbCtrl2    0x00000000    global control register [Memory Mapped]    
SetInt    0x00000200    Set Interrupt Register [Memory Mapped]    
ClearInt    0x00000200    Clear Interrupt Register [Memory Mapped]    
SetIntLVL    0x00000000    Set Interrupt Level Register [Memory Mapped]    
ClearIntLVL    0x00000000    Clear Interrupt Level Register [Memory Mapped]    
Flr    0x00000900    Flags Register [Memory Mapped]    
IntVect0    0x00000000    Interrupt Vector Offset 0 [Memory Mapped]    
IntVect1    0x00000000    Interrupt Vector Offset 1 [Memory Mapped]    
Format    0x00000007    Format Control Register [Memory Mapped]    
Brsr    0x00000249    Baud Rate Selection Register [Memory Mapped]    
Ed    0x00000000    SCI Data Buffer [Memory Mapped]    
Rd    0x00000000    SCI Data Buffer [Memory Mapped]    
Td    0x00000004    SCI Data Buffer [Memory Mapped]    
Fun    0x00000006    Pin Control 0 [Memory Mapped]    
Dir    0x00000000    Pin Control 1 [Memory Mapped]    
DIn    0x00000006    Pin Control 2 [Memory Mapped]    
DOut    0x00000000    Pin Control 3 [Memory Mapped]    
DSet    0x00000000    Pin Control 4 [Memory Mapped]    
DClr    0x00000000    Pin Control 5 [Memory Mapped]    
PDr    0x00000000    Pin Control 6 [Memory Mapped]    
PDis    0x00000000    Pin Control 7 [Memory Mapped]    
PSel    0x00000006    Pin Control 8 [Memory Mapped]    
LinComp    0x00000000    BLinCompARE Register [Memory Mapped]    
LinRd0    0x00000000    LinRd0 Register [Memory Mapped]    
LinRd1    0x00000000    LinRd1 Register [Memory Mapped]    
LinMask    0x00000000    LinMask Register [Memory Mapped]    
LinId    0x00000000    LinId Register [Memory Mapped]    
LinTd0    0x00000000    LIntD0 Register [Memory Mapped]    
LinTd1    0x00000000    LIntD1 Register [Memory Mapped]    
MBrsr    0x00000DAC    Maximum Baud Rate Selection Register [Memory Mapped]    
SrSel    0x00000000    Slew Rate Control Register [Memory Mapped]    
IoDftCtrl    0x00000500    IODFT for BLin moduler [Memory Mapped]    

Here the Init code for the SCI:

 /** - bring SCI out of reset */
    scilinREG->GCR0 = 0U;
    scilinREG->GCR0 = 1U;

    /** - Disable all interrupts */
    scilinREG->CLEARINT    = 0xFFFFFFFFU;
    scilinREG->CLEARINTLVL = 0xFFFFFFFFU;

    /** - global control 1 */
    scilinREG->GCR1 = (uint32)((uint32)1U << 25U)  /* enable transmit */
                    | (uint32)((uint32)1U << 24U)  /* enable receive */
                    | (uint32)((uint32)1U << 5U)   /* internal clock (device has no clock pin) */
                    | (uint32)((uint32)(1U-1U) << 4U)  /* number of stop bits */
                    | (uint32)((uint32)0U << 3U)  /* even parity, otherwise odd */
                    | (uint32)((uint32)0U << 2U)  /* enable parity */
                    | (uint32)((uint32)1U << 1U);  /* asynchronous timing mode */
                    
    /** - set baudrate */
    scilinREG->BRS = 585U;  /* baudrate */

    /** - transmission length */
    scilinREG->FORMAT = 8U - 1U;  /* length */

    /** - set SCI pins functional mode */
    scilinREG->PIO0 = (uint32)((uint32)1U << 2U)  /* tx pin */
                    | (uint32)((uint32)1U << 1U); /* rx pin */


    /** - set SCI pins default output value */
    scilinREG->PIO3 = (uint32)((uint32)0U << 2U)  /* tx pin */
                    | (uint32)((uint32)0U << 1U); /* rx pin */


    /** - set SCI pins output direction */
    scilinREG->PIO1 = (uint32)((uint32)0U << 2U)  /* tx pin */
                    | (uint32)((uint32)0U << 1U); /* rx pin */


    /** - set SCI pins open drain enable */
    scilinREG->PIO6 = (uint32)((uint32)0U << 2U)  /* tx pin */
                    | (uint32)((uint32)0U << 1U); /* rx pin */


    /** - set SCI pins pullup/pulldown enable */
    scilinREG->PIO7 = (uint32)((uint32)0U << 2U)  /* tx pin */
                    | (uint32)((uint32)0U << 1U); /* rx pin */


    /** - set SCI pins pullup/pulldown select */
    scilinREG->PIO8 = (uint32)((uint32)1U << 2U)  /* tx pin */
                    | (uint32)((uint32)1U << 1U); /* rx pin */


    /** - set interrupt level */
    scilinREG->SETINTLVL = (uint32)((uint32)0U << 26U)  /* Framing error */
                         | (uint32)((uint32)0U << 25U)  /* Overrun error */
                         | (uint32)((uint32)0U << 24U)  /* Parity error */
                         | (uint32)((uint32)0U << 9U)  /* Receive */
                         | (uint32)((uint32)0U << 8U)  /* Transmit */
                         | (uint32)((uint32)0U << 1U)  /* Wakeup */
                         | (uint32)((uint32)0U);  /* Break detect */

    /** - set interrupt enable */
    scilinREG->SETINT = (uint32)((uint32)0U << 26U)  /* Framing error */
                      | (uint32)((uint32)0U << 25U)  /* Overrun error */
                      | (uint32)((uint32)0U << 24U)  /* Parity error */
                      | (uint32)((uint32)1U << 9U)  /* Receive */
                      | (uint32)((uint32)0U << 1U)  /* Wakeup */
                      | (uint32)((uint32)0U);  /* Break detect */

    /** - initialize global transfer variables */
    g_sciTransfer_t[1U].mode   = (uint32)0U << 8U;
    g_sciTransfer_t[1U].tx_length = 0U;
    g_sciTransfer_t[1U].rx_length = 0U;

    /** - Finaly start SCILIN */
    scilinREG->GCR1 |= 0x80U;

  • Hi,

    Can you pls re-check your pinmux once.

    I'm assuming you are looping back the TX and RX since you have mentioned hardware loopback.

    If your pinmux looks okay, then pls share your project so that I can then have a quick look to see if you are missing anything.
  • I checked my pinmux several times. Only for the sci1 are mux options necessary.

    For the hardware loopback I connected the rx and tx pins and observed the pins with a scope.

    The scope recognises the message but not the receiver in the TMS.

    I tested also the internal loopbacks (digital and analogue) without  any success.

    Here is my project:

    2100.sci_test.zip

  • can you pls make sure that the receive state machine is not busy before you start using the module.

    pls add the following line after you initialize the module and before you transmit

    sciInit();
    while ((scilinREG->FLR & 0x4) == 4);

    That should get it working.
  • Tobias,


    Karthik solution is working.
    Let me explain the rational behind.

    Once the sciInit routine is called, after setting all parameters for the SCI (including baudrate) the SCI is released from Reset.
    Because of the Asynchronous communication, the SCI as to sample the RX line for 11 clock period at baudrare value to detect the IDLE state. (RX 1 for 11 period)
    Once this IDLE period is detected, a Flasg is set in FLR register. Based on your baudrate, this can take some time.
    If you try to transmit or receive during this synchronization time, the SCI will not work.

    In a real application, usually the SCI is initialized during startup and a real communication happen later.
    In this test code, the communication (sciSendByte) happens just after the sciInit, during the IDLE detection.

    while ((scilinREG->FLR & 0x4) == 4);
    This will force the device to wait for this IDLE period to be detected.

    If Analog Loop Back is used, the out going data will be viewed on the TX pin (and received by SCI), but if a data is received on the RX pin, the SCI will not get this data.

    Here is an easy modification to create an echo of each received data on the RX pin.

        while(1)
         {
            byte = sciReceiveByte(scilinREG);
             sciSendByte(scilinREG, byte);
            nbytes ++;
        }

  • Tobias,

    What is the status on this thread? Have you fixed your problem?
    Please close this thread if your question has been answered.
  • I have solved the problem.
    The microcontroller hardware for the SCI was defect.
    Changing the controller solved the problem.
    Many thanks.