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.

TMS570LS3137: Problem with the SCI UART of the TMS570LS3137

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN,

Hello,

I made my own board with a TMS570LS3137PGE on it. Everything works fine, but I have some problems using SCI2 as UART.

First of all, my code works very well with a 9600 baudrate. I can receive and send data correctly. However, in my final application, I absolutely need to have a baudrate of 38400. with such a baudrate I have many errors. The characters received are often false. Perhaps this is due to the adjustment with HalCoGen, which only allows a baudrate of 38462, not 38400? How can I fix this problem?

Secondly, there is something I don't understand. I am currently using interrupts to read the received data. If I don't put a "sciReceive()" in the main function (polling), then I never get into the interruption. Why this?

I attached my project in.zip so you could see what I did.

8640.DownLinkUpLink.zip

Thank you in advance for your help.

  • Hello,

    Asynchronous baud rate depends on VCLK and prescaler value.
    For SCI/LIN module the formula for calculating SCI baud-rate is in TRM, Section 26.2.3
    For SCI module see section 27.2.3

    This is from sciReceive function definition:

    *   Receive a block of 'length' bytes long and place it into the
    *   data buffer pointed to by 'data'.  If interrupts have been
    *   enabled the data is received using interrupt mode, otherwise
    *   polling mode is used.  In interrupt mode receive is setup and
    *   the routine returns immediately, sciReceive must not be called
    *   again until the transfer is complete, when the sciNotification
    *   callback will be called.  In polling mode, sciReceive will not
    *   return  until the transfer is complete.

    sciReceive, when interrupt mode is used, sets up rx.length and pointer to data and returns immediately.

    Here you can find explanation of sciReceive function:

    Best regards,
    Miro

  • Thank you for your answer.

    I was able to try to modify the exact value of the baudrate according to VCLK and prescribe value, but nothing to change for my problem.

    With baudrates from 4800 to 19200, my code works perfectly. From 38400 (baudrate that I have to reach) and more, when I make a transfer from the PC to the TMS570LS3137, some characters are correct, others are not.

    I don't understand why I don't have a problem with some characters but I have problems with others.

    Thank you again in advance.

  • Hello,

    Do you have the same problem when using polling method?

    Best regards,
    Miro

  • Hello,

    Yes I observe the same problem in polling mode

    Best regards,
    Maxime

  • I may have noticed something strange:

    At 38'400 baud, when I send data from the MCU to my PC, all received data is correct. However, when I send data from my PC to the MCU, many characters are wrong.

    If I modify my terminal settings (I use Termite) to 38'000 baud, this time all characters sent from the PC to the MCU are correct! However, this time, the data received on my PC, sent by the MCU, is no longer correct.

  • The problem is solved! It was a ground problem between two PCBs... (Solution was so dumb ..)

  • Hello,

    Thanks for the feedback!