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.

What is my reference to follow in order to communicate with the MCU?

Other Parts Discussed in Thread: LAUNCHXL2-RM46, HALCOGEN

HI

I have the Hercules LAUNCHXL2-RM46. I want to communicate with it from a stand-alone program from the PC. As we know, that launchpad is connected to the computer through the USB cable. I already loaded project0 to the MCU, but I couldn't find the reference that I read so that guides me to do the communication and data send/receive from a stand-alone program in C for example from the Computer.

Please help me

  • Abdulrhman,

    It depends on what you are asking.

    The XDS110 which is the only USB connector on the Launchpad - makes a virtual COM port available to the PC. The other side of this com port is connected to the LINRX/LINTX pins of the MCU - which you can use as a UART on the RM46 device. So you would start with 'example_sci_uart_9600' from HalCoGen. For the RM46 launchpad make sure the SCI that you use for the UART is 'SCI2'. And make sure on the Driver enable tab that you have "Enable SCI2 Driver" checked. SCI2 and LIN1 are the same module, which is a weird naming convention but we have one SCI only port (SCI1) and one port that is either LIN or SCI (LIN1/SCI2). it's the LIN/SCI that is connected to the XDS100.

    The RM46 device also includes a USB device, and HalCoGen has a USB CDC device example. In which case this software could implement the virtual com port directly on the RM46. See: HALCoGen USB Device - driver & CDC Class processors.wiki.ti.com/.../HALCoGen_USB_Device_-_driver_&_CDC_Class

    However, the launchpad does not have a PHY for this USB port. You would need to either build your own expansion board w. phy or upgrade to the HDK if you want to use the USB device directly on the RM46.
  • Dear Mr. Anthony F. Seely

    First, I am thinking of connecting with it from a stand-alone program in C. Can you help me to start that step?
    Second, I am really confused about what you are saying above, you might need to polish the answer more for me as a beginner and after reading the first point in this post?

    I am really happy of you because you are really active in this community...

  • Hi Abdulrhman

    I would say if you are a beginner then you need to think about it this way:
    1) you can use the USB *cable* to talk to the launchpad. (aside from debugging).

    2) but you won't be using USB. The USB part will be hidden from you inside the XDS110.
    that feature is already there. If you look in windows device manager, you should see that there is a
    COM port associated with the XDS110 device. Note the COM port number and use this COM port inside
    a terminal program like 'putty' to connect to connect a terminal to the board.

    3) to make the board talk to the terminal, the example_sci_uart_9600 is what you can start with.

    In a nutshell it will feel like you are writing a much simpler program to talk over a UART rather than USB.

    But the physical connection will be over the same USB cable that you use for debug and for powering the board.

    Best Regards,
    Anthony
  • Thank you for your reply Dear Mr. Anthony,

    I updated my main post, and I made it general communication from the microcontroller to a stand-alone program written in the computer in C language for example.
    During the communication, I want the stand-alone program run the program inside the MCU, and send receive data to/from it, and then improve the stand-alone program to provide on it user interfaces and control buttons, that control the program on the MCU.

    If you feel that you can add more details after you read this, pease add them.

    Best Regards,
    Abdulrahman
  • In this post, I come back and say that I implemented the solution that I got from above posts.
    The achievements so far are:
    - Created the example_sci_uart_9600
    - Ran the terinal (the built-in terminal) and received the "Hello World" text.

    Now what is my next step? Is it to go and learn putty?
  • Hi Abdulrhman,

    Sounds like you are making great progress if you succeeded to get "Hello World" printing out on the terminal.

    It doesn't really matter which terminal program you use so using the terminal that is included with CCS is fine. I mentioned Putty because sometimes a stand-alone terminal program is useful .. it can be nice to talk to your embedded system from a machine that doesn't have CCS installed. Putty is a much smaller program and is a good one for this purpose. But recommending a particular terminal program would be like me recommending one text editor over another. Everyone has their favorite - so just find one that works for you and that you like and stick with it - that's my suggestion.

    Just reading your description it sounds like you want to have 2 different programs:
    1) running on the PC with some sort of GUI (buttons, etc)
    2) running on the MCU - that responds to commands from the PC.

    For 2) you can build this program right now - building on what you have. You just need write some code that reads through the data sent by the PC, finds commands, and jumps to the appropriate command handling function. You can test this with the terminal program if you make the commands human readable... For example you might decide to use the command "START" in ascii characters to start your operation on the MCU. Then even before you have the GUI you could test your program on the Hercules by typing "START" into the terminal.

    For the GUI on the PC there are so many options - I can't really recommend one over another.
    One class that I took online may be a fit - www.pluralsight.com/.../introduction-qt-cplusplus-framework The teacher of this class shows you how to make a GUI that is a virtual front panel and communicates with a remote machine over TCP/IP but you could probably easily modify the example to use the serial port instead - since the Qt framework has functions for serial as well.

    But you can also use tools like Matlab, Labview, etc, etc, etc. for this sort of work.
    So if there is a tool you are already comfortable with you may investigate that tool first.
  • I understood your guidelines. Thank you Mr. Anthony Seely,

    Now, from point (2) you mentioned above, I need your help to find a reference that let me write some code that reads through the data sent by the PC, finds commands, and jumps to the appropriate command handling function.

    Thank you
  • Hi Mr. Anthony F. Seely,

    Following above discussion, I got into having :

    - a working example_sci_uart_9600

    - Example 1

    Now I need a help how to get advantages of the above listed things. What specifically I need is STARTING an operation on the MCU.

  • AbdulrhmanAlsri said:
    What specifically I need is STARTING an operation on the MCU.

    Abdulrhman,
    Sorry - don't understand what you need to do. 
    HalCoGen will generate all the code to get you to main().  but you should have that in your UART example already.
    So I don't think you are asking about the startup code... but not sure what you are asking.