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.

TMS570LS0432 SCI RX problem (IDLE state)

Other Parts Discussed in Thread: TMS570LS0432, HALCOGEN

Hi,

I'm working with a custom board with TMS570LS0432 processor and i'm trying to use the SCI module to receive a byte from another similar board. I linked the boards with TX (sender) in RX (receiver) only. The receiver code stop in a while loop that check the flags:

uint32 sciReceiveByte(sciBASE_t *sci)

{
/* USER CODE BEGIN (16) */
/* USER CODE END */

// THE CODE STOPS HERE!!!!!!!!!!!!
while ((sci->FLR & (uint32)SCI_RX_INT) == 0U)   //<-------------
{
}

return (sci->RD & (uint32)0x000000FFU);
}

The FLR flag register has the following value 0b00000000000000000000100100000100 that indicates a IDLE state. How can I solve this problem?

I'm using Halcogen to generate the HAL code using the following configurations:

  • Hi Davyd,
    Looking at the first screenshot I'm not sure if the internal clock and asynchronous mode checkboxes are checked. It kind of grayed out when I view it.

    Next thing is if you have seen any TX activity from the other board? Did you use the same TMS570LS04/SCI in other board to generate the TX? Or the TX is generated by a different uC?
  • Hi Charles,

    Thank you for your reply.

    The check box are grayed out because they are disable for check/uncheck. I can't change its values.

    The TX board is equal to RX board. Only the code changes. Instead of use sciReceiveByte(), i'm using sciSendByte() passing 0xAA as data. I can view the TX signal in a osciloscope correctly.

  • HI Davyd,

    Can you check the SCIGCR1 register for bit 5 (CLOCK) and bit 1 (Timing Mode) in your receiver board? What do they indicate? They should be internal clock and asynch timing. If they are not, then I will first suggest that you recreate a new HalCoGen project for the receiver board because I don't understand why they were grayed out in the checkbox. They should be selectable.
  • Hi Charles,

    The value present in the SCIGCR1 is 0x03000022. CLOCK and Timing Mode are 1 (The internal SCICLK is the clock source  and Asynchronous timing). I think the check box is grayed out because the device don't have a external clock pin. I created a new project with only SCI driver enable but nothing changed. This is my sciInit() function and the main code for the receiver:

    /////////// MAIN.C 

    uint32 data = 0x00;

    _enable_interrupt_();

    sciInit();

    while(!sciIsRxReady(scilinREG));

    while(1)

    data = sciReceiveByte(scilinREG);

    ////////////// INIT

    void sciInit(void)

    {

    /* USER CODE BEGIN (2) */

    /* USER CODE END */

       /** @b initialize @b SCILIN */

       /** - 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 = 520U;  /* 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)1U << 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 << 0U);  /* Break detect */

       /** - set interrupt enable */

       scilinREG->SETINT = (uint32)((uint32)1U << 26U)  /* Framing error */

                         | (uint32)((uint32)1U << 25U)  /* Overrun error */

                         | (uint32)((uint32)1U << 24U)  /* Parity error */

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

                         | (uint32)((uint32)1U << 1U)  /* Wakeup */

                         | (uint32)((uint32)1U);  /* Break detect */

       /** - initialize global transfer variables */

       g_sciTransfer_t.mode      = (uint32)1U << 8U;

       g_sciTransfer_t.tx_length = 0U;

    g_sciTransfer_t.rx_length = 0U;

       /** - Finaly start SCILIN */

       scilinREG->GCR1 |= 0x80U;

    /* USER CODE BEGIN (3) */

    /* USER CODE END */

    }

  • I'm analysing TX again. I sent 0b10000010, but seems that the last bit is not appearing in the TX line. I marked with cursors the data period and the last bit 0 is not shown. Can this problem in TX cause the RX IDLE problem?

  • In order for the receiver to clear the IDLE bit, the bus must be idle for 11 bit periods. Looking at your scopeshot I'm not sure if you have enough idle period. Seems like on the transmitter side you are trying in a while loop sending 0b10000010? Can you put some delay before you start the next transmit if you are in a while loop?

    Can you check if both the transmitter and the receiver boards are configured with the same baudrate?
  • I did a simple test with the LS04 launchpad as a receiver and uses another Hercules Launchpad such as LC4357 to transmit the data. I'm able to properly receive the message on LS04 side. The message I sent from the LC4357 is a string "HERCULES..".