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.

TMS570 using UART to communicate to another device

Other Parts Discussed in Thread: HALCOGEN, TMS570LS1224

I am trying to do a simple project where I connect the microcontroller to another device with a UART connection (Rx to Tx and Tx to Rx). I would like to send data from USB to the microcontroller, through UART, to the other device, back through USB and to the computer.

I am not exactly sure how to use the UART pins to send data/how to send data through them. It appears that I need to use the Serial Communication Interface to do so, but I'm not exactly sure how - do I need to do something in HALCoGen to indicate that I want to use the pins to communicate with another device?

What I have done so far is follow the instructions here: https://training.ti.com/hercules-how-tutorial-using-sci-uart-communication

The project in the tutorial was to use sciSend and sciReceive to communicate between the terminal (COM port) on the computer and the microcontroller using the SCI. However, it appears that this does not use the UART pins at all, because it worked without a jumper wire from Rx to Tx.

Here is the pin map if it helps: http://www.ti.com/lit/ml/spnu611/spnu611.pdf

I followed these instructions in HALCoGen:'

In this view, we will see a block diagram of the microcontroller. We can navigate through HALCoGen by either using this block diagram or by using the tabs located near the top of the screen. The next step is to go to the Driver Enable tab and enable only the SCI2 driver. We do this by selecting Unmarked Mark All Drivers and then selecting Enable SCI2 Driver.

The next step is to go to the SCI2 tab, and in the SCI Global sub-tab, enable the receiver interrupt. With this configuration, the SCI will generate a CPU interrupt every time data is received by the module. Next, we click on the SCI data format tab and ensure that the module is setup with a 9,600 baud rate, 8 data bit length, and 2 stop bits, and no parity.

The final configuration to be made in HALCoGen is to go to the VIMM, or Vector Interrupt Manager Module, and enable channel 13. This will enable our SCI interrupt in the VIM module. Next, we need to generate code. To do this, we go to File, Generate Code. HALCoGen now generate all the startup and peripheral drivers that are needed to complete this exercise.

TLDR:
- Enable drivers tab -> enable only SCI2/LIN
- SCI2 tab -> SCI Global sub tab -> enable Rx interrupt
- Enable VIM channel 13 (LIN High)

How should I modify this to use the UART to communicate with another device? Should I enable the SCI driver instead? What should I do from there? (Or should I do something else)

Am I missing the fundamental understanding of how the SCI and UART work?

I would really appreciate any advice you might have - thanks!

  • Hello Meera,

    I am currently reviewing your post and will get back with you as soon as I have additional information.
  • Since you referenced SPNU611, I assume you are using a TMS570LS12x Launchpad. The TMS570LS1224 has two UARTs, one is a LIN/SCI2 combination and the other is just a plain SCI. In the Launchpad schematic on sheet 12, section A1, you can see that the LIN pins are connected to U7. U7 is the chip that creates the XDS110. The XDS110 is not only a JTAG controller, but also acts as a USB to Serial port for your PC. In the example code from the tutorial SCI2 was writing to the PC and receiving from the PC. The LIN pins are already used on the Launchpad.

    If you want to connect two launchpads together by a UART, I suggest you use the plain SCI, pins J2-3 and J2-4.

  • Thank you for the help. Yes, that is the Launchpad I am using.

    Do you have any recommendations for how to configure the SCI pins to communicate to another device (i.e. on HALCoGen and CCS)? I am relatively new to this and still learning my way around.

    I tried following this procedure on HALCoGen, but I am not sure if it is correct:
    1. Driver Enable -> enable the SCI driver only
    2. PINMUX tab -> in the enable/disable peripherals box, check “SCI”
    3. Go to SCI tab
    4. Not sure if I need to do anything in the SCI Global tab?
    5. SCI Data Format -> 9600 baud rate, 8 bit length, 2 stop bits, no parity
    6. Not sure what I should do in the SCI Port tab (TX pin mode, RX pin mode, TX pin, RX pin)

    As far as CCS goes, should I be using the sciSend and sciReceive methods?

    Do you have any further suggestions?

    Thank you!
  • Hello Meera,

    Once you configure HalCoGen, you would need to have it generate the code. Once it has been generated you would need to import the code into a CCS project and build your application by calling the driver functions created by HalCoGen. The example project that you mentioned that communicates with the PC should serve as a template on how to build your application but the SCI ports ports will be the ones that Bob has mentioned.
  • Meera,

    This training video should be helpful for you "Hercules Tutorial: SCI/UART Communication"

  • Thank you for the advice. I was aware of how to generate code using HalCoGen and import it to CCS but wasn't sure whether the instructions in the tutorial would still be applicable.

    I will try to follow that process and let you know if it works.

    Thanks!

  • Hello !

    I am trying too to exercise on the LaunchPadls12X. I follow the instructions of the tutorial (which is made for RM4... unfortunately, there is very few helps about tms570ls1224 MCU, and tutorials are often not applicable to other processors/development kit)

    I would like to know if any one knew how to have this exemple works with this LaunchPad ? I have to serial ports when I plug the launchpad to my PC : XDS110 Class Application/User UART(COM6)
     and XDS110 Class Auxiliary Data Port(COM7). Trying to open temrinal in CCS only results in "No such port : 'COM5/7", and I have no idea what to do ...



    Any help would be appreciated ! And if there is any usable tutorials applicable to this LaunchPad, this would be great !

    Thanks