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.
Save design time and get into production faster with C2000 MCU’s with MathWorks solutions.
To begin you use MATLAB® and Simulink® to create and simulate your algorithms. Next you use Embedded Coder® to generate production code of your algorithms. Embedded Coder support for Texas Instruments C2000 includes:
You can also generate code that runs on the Control Law Accelerator (CLA), a co-processor available on select TI Delfino and Piccolo processors.
For multicore systems, you can use SoC Blockset with C2000 Support for SoC Blockset to build your system architecture using processor, inter-processor communication, interrupt and I/O models, and simulate the architecture together with the algorithms. This allows you to partition algorithms between multiple cores to achieve design modularity and improve performance, and to account for issues like ADC-PWM synchronization and latency.
From within MATLAB you can access hardware support for Embedded Coder via the Add-On Explorer from the MATLAB toolstrip.
Search for C2000, and select to download and install free C2000 library blocks. You insert and configure the blocks, which include IO and various functions, in your Simulink model. Then you use Embedded Coder to generate production code of your algorithm and run it directly on your TI C2000 MCU. The library blocks include documentation, example models, and support C2000 Piccolo, Delfino, and Concerto families.
Note: Using Embedded Coder requires additional MathWorks software: MATLAB®, Simulink®, MATLAB Coder™, and Simulink Coder™.
You can also just generate production code of your algorithms which can be imported and integrated into an existing Code Composer Studio project.
--- ---
Here is more info including how-to videos and examples you can run with TI hardware kits:
How-to Videos and E2E posts:
YouTube: Programming TI C2000 Launchpad with Simulink (18:11)
YouTube: Using a TI F28069 LaunchPad with Simulink (16:32)
YouTube: Introduction to LAUNCHXL-F28069M Launchpad (Gautam Iyer, TI MVP)
YouTube: Introduction to LAUNCHXL-F28027 Launchpad (Gautam Iyer, TI MVP)
E2E: THE BEAST IS HERE: LAUNCHXL-F28379D (Gautam Iyer, TI MVP)
E2E: The Most Powerful C2000 Launchpad: LAUNCHXL-F28377S (Gautam Iyer, TI MVP)
Solution Overview:
Short videos (2-3 min): Embedded Coder Overview, Targeting TI Piccolo
Multicore simulation support using SoC Blockset with C2000 Support for SoC Blockset
Joint TI / MathWorks Sessions:
Details and Examples:
Content Updated 2020-11-02
Chris,
Thank you for the information! In what instances should we ask for help in the TI e2e forum and when should we ask for help in the mathworks forum?
-Ozino
Great to see this info get posted!
The main link for MathWorks Support is: http://www.mathworks.com/support/
There is C2000 info in Documentation, Examples, and MATLAB Answers.
I am also happy to try and answer questions on using MathWorks software with C2000 MCU's in these forums.
Regards,
-Brian
MathWorks Release R2016a is now available to customers, and includes new features for our TI C2000 solution.
1) F28379 Support: Device is now available in the drop down menu.
2) Serial SCI Support: New library blocks for SCI Transmit and SCI Receive on TI C2000 F2807x and TI C2000 F2837x processors for asynchronous serial digital communication.
3) CAN Support: New library blocks for CAN Transmit and CAN Receive on TI C2000 F2807x and TI C2000 F2837x processors.
Hi Rohit,
The SCI Transmit and Receive blocks can be used for RS485 communication. They are included in the C2000 Support Package. We do not have a Modbus specific implementation, but you can build your own on top of the SCI blocks using standard Simulink blocks and Stateflow diagrams.
More info (login may be required)
There are a good number of configuration details within the Configuration Parameters - here's a quick screenshot:
Good luck with your project!
-Brian
Hi Prakash,
The support for F2807x begins with Release R2015b. So you wont see the block library in R2015a. Please update to R2015b (or newer release) and you will gain access to this block library.
I should also note - we continue to add more blocks and features for C2000 (especially F2807x, F2837xS, and F2837xD libraries in every new release. There are a number of features that will be added on R2016b in Autumn and R2017a next Spring.
Thanks,
-Brian
Hi,
I am trying to generate a simple code with 2016a and CCS6.
But I got this error (shown below) in the Matlab command window when I hit the build button in Simulink.
Could you help me figure it out?
By the way, in previous versions (2012 and older), source, library, and header file addresses were entered in Target Preference. In R2016a, I didn't see them. Obviously Target Preference is no more provided. Then, should we enter these source, library, and header files in Custom Code field of Code Generation part in the Model Configuration Parameters.
Regards.
-----------------------------------------------------------------------------------------------------------------------
Undefined variable "Stateflow" or class "Stateflow.SLUtils.isChildOfStateflowBlock".
Error in slmsgviewer/ProcessObjects
Error in slmsgviewer/pushMessageRecord
Error in slmsgviewer.processRecord
Error in slsfnagctlr
Error in slsfnagctlr
Error in slsfnagctlr
Error in slsfnagctlr
Error in coder.internal.simulinkcodermenus
Hi,
I'm running R2016a, and have never seen this error. Contact MathWorks Technical Support for immediate assistance.
Most of the target specific info you enter is in the Simulink Configuration Parameters. Click the Gear icon in Simulink to open that, and look in the Hardware Implementation and Code Generation sections - this is where you specify the HW and toolchain (such as CCS). Also look in the Code Generation -> Templates - this is where you can configure Source file and Header file templates. See R2016a screenshots below.
Cheers,
-Brian
Hi Rohit,
I checked with our development team. We have not yet tested version 15.12.2 LTS.
For the most part you only need to checkEnvSetup for the older idelink_ert.tlc workflow. We are working to streamline/clarify this for future releases, because it is a bit confusing.
Helpful hint: To go back and reconfigure, type targetupdater at the command line - this command skips the download and install steps and goes directly to the configuration steps.
Hi, I have to include the Modbus protocol in the CPU program for F28335. I am generating the code using the C2000 support package for embedded coder so far. I don't quite understand what would be the structure of implementing Modbus RTU over Serial interface and I would like to understand that. Here is what I have gathered from my reading so far:
1. Each Modbus message has following parts:
(a) Address field (b) Data field (c) Error check field
2. The master gives the following message:
(a) Address of slave addressed (b) Function (c) Error check
3. A slave checks if the address in current message is belonging to it. If yes, it gives a response with following structure:
(a) Slave's own address (b) Response to requested function (c) Error check field
What I fail to understand is how does the transmitted data appear and stored or processed. I have the following structure (not sure if it is correct or sensible):
1. The data is taken from the SCI receive block after interrupt: I am confused whether the entire MODBUS message is received in one go, or the interrupt occurs after each byte of conversion? Also, how to we detect if the byte obtained is start bit, address or function or error check or stop bit?
2. The data from step 1 is used in a state machine. If the data is an address, it is first compared to slave address. IF the byte next received is a valid MODBUS function code, an appropriate response is prepared and sent out through the SCI transmit block.
Can someone help me?
Hi Rohit,
I personally do not have experience with MODBUS, so I cant help you in a significant way other then provide small suggestions.
Basically what I am told is that you can configure the Serial receive block to get an interrupt after receiving 1-16 bytes based on your requirement. The F28335 processor has 16 bytes serial FIFO. To detect the start, address and data, you have to implement the logic after receiving the data.
Here is the block help: http://www.mathworks.com/help/supportpkg/texasinstrumentsc2000/ug/c28xscireceive.html
For additional help, please contact MathWorks Technical Support
-Brian
Brian,
One of our customers is interested in this.
Does Embedded Coder for F2807x/F2837xS/F2837xD supports generating CLA codes?
Does it advise how to partition in between C28x/CLA or optmize the code for two cores if both C28x/CLA are used on F2837xS?
For F2837xD, which has 2xC28x/2xCLA, does it advise how to partition in between C28x/CLA or optmize the code for those four cores?
Wayne Huang
Hi Wayne,
CLA for the F2837xS/D & F2807x isn't supported, yet. We are actively working on it and I am hopeful it will make the R2016b Release this Autumn. The feature will not provide advice on partitioning - just the ability to do so. If will operate similar to the CLA support we have for the other parts.
Using CLA documentation (login may be required)
CLA Example (login may be required)
The ability to select the core for your model/algorithm on the F2837xD is already available, you need to select CPU1 or CPU2 in the dropdown.
Thanks,
-Brian
Hi Brian,
How to program the CPUs (I mean divide the tasks between CPUs) for F28377D using matlab embedded coder, also programming the CLAs? No examples shows the work with this processor.
Hi,
Thanks for your reply,
Actually, I knew how to select the processor during debugging. My equation is how to divide the tasks between the processors in the same simulink window. Assume you have x+y/z+v and you would like to do x+y in cup1 and the result z+v in cup2 and the final results are used in cpu1 to complete the / operation.
Thanks
Hi Caleb,
If you use a Simulink model, Embedded Coder, and our Support package for C2000 MCU's, you can use a feature called External Mode to interactively tune parameters and log data from Simulink on a C2000 MCU.
Here is a documentation link (login may be required): http://www.mathworks.com/help/supportpkg/texasinstrumentsc2000/ug/external-mode.html
The key here is that this requires a Simulink model. So you'd need to implement that CCS example Simulink to use the MathWorks workflow and leverage External Mode. When MathWorks auto generates the code with for the MCU with this workflow, we add the External mode feature into the code which allows for the parameter tuning and signal logging - it isn't available otherwise.
You might be able to communicate to MATLAB manually via a serial link, but I don't think that will allow you to do parameter tuning - just log the data.
Cheers,
-Brian
MathWorks Release R2016b is now available to customers, and includes new library blocks for C2000 processors:
1) eCAP Support: New library block for capturing input pin transitions or configuring auxiliary pulse width modulator on TI C2000 F2807x and TI C2000 F2837x processors.
2) eQEP Support: New library block for interfacing with a linear or rotary incremental encode on TI C2000 F2807x and TI C2000 F2837x processors.
3) CLA Trigger Support: New library block allows you run code on Control Law Accelerator (CLA) co-processor available on F2803x, F2806x, F2837xS, F2837xD, and F2807x processors.
4) DAC Support: New library block for converting digital data to analog signal on TI C2000 F2807x and TI C2000 F2837x processors.
----
We added examples which will work with the F28377S LaunchPad. They are listed along with the examples for existing devices (such as F28069, for example)
We enhanced external mode to use serial flow control, so you can now log ~20 signals at 1kHz, or 1 signal @ ~5kHz on a C2000.
---
Here's a screengrab of the updated F2837xS block library:
Remember, the support is a free download, but does require Embedded Coder from MathWorks.
Hi,
Here is some feedback from my development team:
1) From the error log, it looks like downloading to the hardware board is failing. Please ensure that you can connect to the board using CCS.
If you are able to connect to the hardware using CCS, then use the same ccxml configuration file in your Simulink model also. You can change is from Model Configuration Parameter -> Hardware Implementation -> Target Hardware Resources -> CCS hardware configuration file.
2) SCI-A is used by default for external mode by default. You can modify the shipping source file (SUPPORT_PACKAGE_INSTALLATION_FOLDER\toolbox\target\supportpackages\tic2000\src\rtiostream_serial_c28x_ext.c) to configure the SCI-B for external mode.
HTH,
-Brian
Dear Brian,
Thank you very much for your help and concern indeed,
I did the suggested solutions in the previous post; however, I faced other error this time (shown below); any suggestion is really appreciated.
Many Thanks
Hi M_SRM,
Clearly a build error - but not enough info for me to help diagnose it. Probably fastest way to get help is for you to contact MathWokrs Technical Support.
Thanks,
-Brian
Dear All,
You can follow my YouTube Channel for Video Demonstrations on using Simulink with C2000 devices & Booster Packs :
https://www.youtube.com/channel/UC0vWIpaMzxZ0RqT4r4Kp75w
Regards,
Gautam
We just posted YouTube Live video and example model of a new DC-DC Buck demo using F28377S LaunchPad an DPS BoosterPack.
Link to YouTube Live session:
Link to example model:
http://www.mathworks.com/matlabcentral/fileexchange/61420-dc-dc-buck-converter-example
If you are interested in Digital Power with C2000 and MathWorks tools, check it out.
-Brian
Brian,
Finally I programmed my F28379 processor through Simulink. Now I'm able to transmit messages over CAN but I can't read it with Vector CANalyzer or other CAN transceivers. When I monitored the signal with oscilloscope, I saw this weird waveform:
There should be something wrong with my transmission configuration. CAN communication is supposed to be a differential comm system but as you can see both high and low waveform are identical.
Is there any wrong setting I'm using? I'm confused because I didn't find anything in Simulink.
Thanks,
Kash
Hi Kash,
I'm not sure why you see these results.
Did you double check that your have your 120 ohm termination resistors? I suspect you do, but still worth checking - just in case.
You can contact MathWorks Technical Support for additional assistance.
Cheers,
-Brian
It appears you are scoping CANTX & CANRX on the MCU side (i.e. "before" the CAN transceiver), not CAN_H and CAN_L of the CAN-bus "after" the CAN transceiver. If you capture the ACKnowledge phase also on the scope you should see a "high" on CANTX and "low" on CANRX.
Gautam,
Thanks for your message.
I watched your movie, it's actually helpful but I think I found out the problem. I'm using TMDSDOCK28379D prototype board and there is no CAN transceiver on it while on LAUNCHXLF28379D boards (the one that you're using) there is a SN65HVD234DR CAN transceiver as below. That's why I can't see the differential signal waveform so I can't use CANmate or other devices to read CAN messages. May be I need to switch LAUNCHXL boards.
MathWorks Release R2017a is now available for download. We've made some enhancements to our C2000 Support, which is a free download but requires our Embedded Coder product.
Block |
Usage |
SPI Receive |
Receive data via serial peripheral interface (SPI) on target. |
SPI Transmit |
Transmit data via serial peripheral interface (SPI) to host. |
I2C Receive |
Configure inter-integrated circuit (I2C) module to receive data from I2C bus. |
I2C Transmit |
Configure inter-integrated circuit (I2C) module to transmit data to I2C bus. |
---
The project creation might be particularly helpful if you don't already have an existing CCS project - easing the the transition from the MathWorks environment to the CCS environment for C2000 projects.
Also, if you are doing power systems, don't forget we posted a new example for a DC-DC Buck with F28377S LaunchPad. There is an associated YouTube video which explains the demo.
Cheers,
-Brian
MathWorks video: F28069M TI processor for AC Motor control
A MathWorks Senior Application Engineer has been doing a series of videos on Mechatronics. He just posted a new video that shows targeting of F28069M TI processor for AC Motor control. This is part of the YouTube series, Mechatronics with MATLAB & Simulink.
Here’s a link to the new video: https://www.youtube.com/watch?v=iev0jyqX2CI
A lot of details in here on how to go from simulation model to HW, and showing the results on O-scope. Take a view, should be interesting for people who are working thru implementation details from MathWorks tools to C2000 MCU's.
Cheers,
-Brian
WOW! All three of the added features were ones I was hoping for. I may just have to download 2017a!
Don Johnson,
Delphi