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.

Setting up a serial host using simulink for piccolo launchxl-f28027

I made a simple program using simulink that reads an analog voltage, and turns an LED on or off depending on the value read. I would now like to add the ability to send the read values back to my computer. From what I've understood, the best way to do this is to create a serial host in simulink. I have done this and it seems to work fine with relatively low sampling rates (0.5 s). However, I want to send values at a rate of .01 s. When I do this, all of the values reach the computer and are displayed on the scope, but the simulation takes a long time to catch up. 

Is there a way to get a real time visualization of the voltage for rates of around .01 s using simulink? or should I try another approach to creating a serial host? 

Thanks in advance!

  • HI Eric,

    Is this using Simulink only, or are you also using Embedded Coder and our C2000 Support Package (which is a free download for Embedded Coder)?

    -Brian

  • I am using Simulink along with embedded coder and the C2000 support package. I have been using blocks from the C2000 package in order to set up the host and receive the serial communications

  • Hi Eric,

    Try looking at this example which covers connecting to a C2000 via serial link (USB is easiest) and doing signal logging and parameter tuning from Simulink & Embedded Coder. It should be in the examples that ship with the C2000 Support Package.  

    Link (login may be required): http://www.mathworks.com/help/supportpkg/texasinstrumentsc2000/examples/parameter-tuning-and-signal-logging-with-serial-external-mode.html

    Note there are some troubleshooting tips at the bottom of the page.

    Thanks,

    -Brian

  • Hi Brian, 

    Thanks for the link. I followed it and tried to follow the instructions. However, when I try to run the program in external mode, it seems as though simulink can not connect to the target. I just spent a long time on the phone with mathworks and we went over all of the parameters and found that everything was set correctly. The only issue seemed to be with the flash API. 

    In the pane of the simulation configuration that specifies the location of the API, there is an option to execute. When I press it, I get this message:

    "Cannot stat CCS application (COM error ID:0x80040154). Verify that your CCS software is installed and configured properly."

    From my understanding, my CCS is installed properly since I've been able to connect to the target and load ".out" files onto it in the past. Is there something extra that I need to do on the CCS side? 

    I also have a few more questions regarding serial connectivity in general with the f28027 boards. When I use the SCI_Transmist block from the C2000 support package, it only allows me to send integer values. How would I go about sending doubles and other data types through the serial port? 

    Finally, the link you posted seems to allow for transfer of the data, but it seems directly tied to simulink. How would I go about creating a standalone serial host for this board?

    I'm sorry for all the questions but I'm really struggling with getting started on the board. Thanks

    -Eric