Hi, I am Saipraveen. I work at MathWorks
In this video I will show you how to get started with the embedded coder support package for Texas Instruments C2000 processors.
Once we go through the setup and installation of the support package
I will show you a demo of an LED blinking on the F28379D launchPad
So before we get started lets go through the things you will need to follow along
You will need MATLAB R2017b or upwards with an active license
for the purpose of this video I will be using MATLAB R2019a.
These are the controllers and launchPads that are supported as of our R2019b.
I will be using the F28379D launchPad for the demo in this video.
However any controlCARD with a docking station should work fine when following the steps shown in this video.
Now that we have all the things we need let's get started by opening MATLAB.
Once you are in MATLAB you can go to the add-on's drop down menu
and click on get add-ons, this should open the add-on explorer where in you can search for C2000
and this will give you a set of results
one of them is the embedded coder support package for TI C2000 processors. Click on it and you can install it.
accepting the license agreement we go onto the next screen
once you go to the next screen, these third party software's will be downloaded and installed
the next part is the setup that will take you through the process of installing other third party softwares
which are required to build and load code into the processor
You could choose set up later and view the blocks from the Simulink library and simulate & generate code from your model
However to build & load the code you need the other third party softwares that will be installed in the setup
Thus I would highly recommend that we go ahead and setup the device now
But in case you would like to set it up later
you can always come back to the setup by going to the add-ons drop down menu and clicking on manage add-ons
going to the options you can come back to the setup
Now in this part of the setup you need to select the processors that you're planning to use with the support package
I would recommend that you chose the relevant processors to reduce the installation and the download time
You can always come back to this part of the setup from the add-on manager to add more processors
once you are done with the selection we can go on to the next screen
now based on my selected processors
I need to download the control suite and the code composer studio from Texas Instruments.
As you can see the TI C2000 ware is not required for the processor that I have selected
However it might be required for the processor based on your selection and you would have to install it
The TI Control Suite is required for building the generated code from Simulink
The code composer studio is required to load your program onto your target
Based on your system if code composer studio or control suite already installed
it would show the installed version here and whether an upgrade is required or you need to download the latest version
if you just want to build the generated code then CCS is not required
However if you want to load the program onto the target then code composer studio is required
You can use any of the code composer studio versions except 9.0.0.
If it has a version that is indicated onto the side which means the indicated versions are the ones with which we have tested our blocks with
we recommend that you install with these versions so that would ensure the smooth working of the project.
The install process is quite straightforward
Click on the link and it would open the TI website on your default web browser
You can download the software from the TI website, you can click on the downloaded file to start the installation.
now you are in the setup, I would recommend that you keep note of the path or location where the software is being installed
as that will come in handy in the later part of the setup process
go through a similar process and download the latest code composer studio
Let's go and start with the installation of the CCS
Similar to the control suite make note of where the software is going to be installed
and proceed with the installation. Choose the product families that you are going to work with and proceed.
now that the installation is complete we can go onto the next screen
here you need to mention the location where the control suite was installed
you also have an option of selecting custom headers and source paths
by default the setup chooses the versions with which our support package was tested
we recommend that you keep the default settings and going on to the next screen
with new versions of CCS you need to browse to the location of where the CCS is installed
and choose the CCS folder path, then you can validate the installation
go onto the next screen, please note that a tested version of the compiler is installed part of the support package installation
The default path to it is indicated here, confirm the same and going onto the next screen
you are shown with a summary of the third party softwares which are installed and the versions along with it
For the control suite and the C2000 ware it is recommended
that you install the version suggested during the setup process
as there are variable name changes from one release to the other and this could lead to some unexpected generated code behavior
However it is safe to upgrade the compiler to the latest release to get the recent bug fixes and optimizations.
you can safely upgrade to the latest version from this link
and update the path to the new compiler in this setup
upgradation of the code composer studio is relatively safe too
Make sure to point to the right folders in the hardware setup and it should be compatible
By clicking on finish you are given with this list of examples that you can go through for your project
Now we can move on to blinking the on-board LED on the F28379D launchPad
In that way we can verify the proper installation of the support package
coming back to MATLAB lets create a new model file
I am calling it blinkLED
Let me also create a new folder here to store the code gen files
going back to the model
Let's first start by going into the configuration parameters
here under the hardware implementation tab you need to select the hardware
that you are using in my case it is an F28379D launchPad
However any board or processor that works with the code composer studio can be used from Simulink as well
in case you have a custom board you can start by selecting a generic processor family
and provide your target configuration file here. To create a new CCXML file, in code composer studio
you can go to file -> new -> target configuration file and create one
when a generic processor family is chosen, the default configurations for the oscillator, the default pins for the peripherals, the baud rate
etc. is chosen based on the controlCARD, you can change these parameters to suit your custom board.Let me go back to the launchPad.
click on apply and ok. Now let me create a simple model to blink the onboard LED
You can start typing anywhere on the screen for GPIO Output
choose the correct processor family, in case of the launchPad we have the blue LED connected to GPIO 31
and the red LED connected to GPIO 34
let's first select GPIO 31, let me use a pulse generator block
let me make it sample based
let me keep a sample time of 0.2
and a period of 10 samples making the period to be 2 seconds, and with a 50% duty cycle it should blink every 1 second.
having created the model, one thing to note is back in the configuration parameters, especially with this launchPad
you have the option to select the CPU that you're going to load the program on to
in my case note that I'm using the CPU 1
and by selecting this check box I chose to write the code into the flash making it stand alone
now let me show you an alternative approach that makes it easier to blink the on-board LED
let me start by adding the GPIO output block
In the block parameters let me select the toggle option for the GPIO 31
next we can a constant block to the input, the sample time of this block would drive the blink period of the LED
let me set a sample time of 0.5
setting a sample period of 0.5 will make the LED blink every 0.5 seconds
now you can deploy this model onto the hardware, thus in this approach you get to control
the blinking of the LED based on the sample time of the constant block
going back to the previous approach
before we deploy this model onto the hardware it is always good to ensure proper connectivity
from the device manager that is available in windows
let me open device manager
once you're in device manager
if the virtual COM port of your device is enabled then you should be able to see a COM port with the XDS100 emulator
also it should be enlisted under the Texas Instruments debug probes, this confirms the proper driver set up of the debugger
and the device connection, so closing it let us come here and deploy the model onto the hardware
you can also do that by using ctrl+b as a shortcut
now that the code generation is complete, you should be able to see the blue LED blinking on the launchPad
in case you want to load this project directly into CCS
to debug or work on it further, you can do that either by importing the project directly from the folder where it was code generated
you could import the CCS project or part of the diagnostics you have a link to open the project directly in CCS.
this will open the project in code composer studio
here you should be able to see the project
in our case blinkLED, you can now debug it from CCS.
that concludes our setup process and the LED blinking demo
this was a very simple example to ensure the proper setup of the support package
based on your requirements and interests, to know more on our capabilities with the TI C2000 controllers
you can explore these examples and documentation
Thanks for watching !