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 transmit problem

Other Parts Discussed in Thread: HALCOGEN

Hi,

I am using the TMS570 Microcontroller Development Stick, with a TMS570LS20216 MCU (ASPGEQQ1).

I have a build that tries to send data over the SCI, but nothing is being transmitted.

If I put the same transmit code into the demo software it transmits OK, but not from my code.

I have checked that the primary system registers are setup ok and the SCI registers are set up OK (identical to the register set up in the demo software), but there must be something else that I am not setting up.

Any ideas where I might be going wrong?

regards,
Dave

  • Dave,

    Can you check the status of the following register: SCI Pin I/O Control Register 0 (SCIPIO0) [offset = 0x3C]
    The default value is 0x0000_0000 meaning that the SCI pins are defined as GIO.
    In this mode, even if a transmission happens, nothing will be visible on the pin.

    Try to change to 0x000_0006 to make SCI_TX and SCI_RX as functional pins and let me know.

    If you can share your code, I can have a look.

    Regards,

    Jean-Marc

  • Jean-Marc,

    Thank you for your quick response.

    I have the SCIPIO0 control register set to 0x0000_0006 in my build.

    I will zip up my project and send it via email.

    Regards,

    Dave

  • Dave,

    Your attachment didn't went through.

    Please can you resent it to my email address.

    Thanks and Regards,

    Jean-Marc

  • Dave,

    Here is my analysis of your code and the reasons of your problem.

    In your init routine, you start setting the swreset bit to 0 in GCR1. This is correct.
    Then you configure all other bits in GCR1 and also set the software reset bit to 1.

    Later you change the baud rate  and the data format.
    This is not recommended. All SCI configurations have to be done with the SCI in reset.

    When everything is set, than you can write the swreset bit to 1.

     

      sciREG1_SG->GCR1 = ( 1 << 25 ) /* Enable transmit */

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

                         | ( 0 << 17 ) /* Disable continue on suspend */

                         | ( 0 << 16 ) /* Disable loop back mode */

                         | ( 0 << 10 ) /* Disable multi-buffer mode */

                         | ( 0 << 8 )  /* Disable sleep mode */

                         | ( 1 << 7 )  /* Stay in reset state to allow configuration */

                         | ( 0 << 6 )  /* LIN mode is disabled SCI mode is enabled */

                         | ( 1 << 5 )  /* Use internal clock */

                         | ( 0 << 4 )  /* 1 stop bits */

                         | ( 1 << 3 )  /* Even parity */

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

                         | ( 1 << 1 )  /* Asynchronous timing */

                         | ( 0 );       /* Do not use address bit */

     

      sciREG1_SG->GCR1 = ( 1 << 25 ) /* Enable transmit */

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

                         | ( 0 << 17 ) /* Disable continue on suspend */

                         | ( 0 << 16 ) /* Disable loop back mode */

                         | ( 0 << 10 ) /* Disable multi-buffer mode */

                         | ( 0 << 8 )  /* Disable sleep mode */

                         | ( 0 << 7 )  /* Stay in reset state to allow configuration */

                         | ( 0 << 6 )  /* LIN mode is disabled SCI mode is enabled */

                         | ( 1 << 5 )  /* Use internal clock */

                         | ( 0 << 4 )  /* 1 stop bits */

                         | ( 1 << 3 )  /* Even parity */

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

                         | ( 1 << 1 )  /* Asynchronous timing */

                         | ( 0 );       /* Do not use address bit */

      /* Setup baud rate to 4800 BAUD register AKA BRS - Baud Rate Selection Register */

      sciREG1_SG->BAUD = 650U;

      /* Setup data transmission length */

      sciREG1_SG->FORMAT = 7U;

    And than

      /* Start the SCI */

      /* Take SCI/LIN out of reset state to allow operation */

      sciREG1_SG->GCR1 |= ( 1 << 7 ); 

    There is another point I want to highlight.
    Once the SCI is released from reset, with a valid configuration, (baudrate, character length…) the SCI needs to synchronize.

     

    Bit 2 IDLE. SCI receiver in idle state.

    While this bit is set, the SCI looks for an idle period to resynchronize itself with the bit stream. The receiver does not receive any data while the bit is set. The bus must be idle for 11 bit periods to clear this bit. The SCI enters this state if one of the following events occurs: a system reset, an SCI software reset, power down, and if the RX pin is configured as a general I/O pin.

    0=Idle period detected, the SCI is ready to receive.
    1=Idle period not detected, the SCI will not receive any data.

    This bit is located in the SCIFLR register. If you don’t wait for this bit to be cleared, the SCI cannot receive any data, but it can still send data.
    The absolute time is directly linked to your baudrate and character length.

    In our driver (HalcoGen) there is no waiting loop for this bit to be cleared in the SCI Init routine. Usually, the application code will have to check this bit before attempting to send any data.

    Again, in your case it is not an issue, you are just sending data.
    For reference, this is what you can do:

    while ((sciREG1_SG->FLR&0x4)==0x4);   //Wait for IDLE bit to be cleared.

    Please let me know if this will fix your problem.

    Best Regards,

    Jean-Marc