File Exchange

image thumbnail

Embedded Coder Target for Energia

Support for low cost Texas Instruments LaunchPads



View License

Energia ( is a low-cost open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.
Simulink example models for Energia supported low cost TI boards. This target includes support for Tiva TM4C123G and MSP-EXP430G2 LaunchPads with Simulink. To get started, start MATLAB R2015b in administrator mode, and go to the installed folder (you can find the installed location with the help of Add ons Manager tool bar in MATLAB) and run the Setup file in order to install the support for Energia. Also the version 0101E0016 of Energia IDE is required.
To know about complete setup and help, follow step by step instructions in Help browser-->Supplemental Software-->Embedded Coder Target for Energia-->Getting Started Guide.

Comments and Ratings (33)

@Mahmoud: Please ensure the Setup is success as captured in the video.

@husam: Please use IDE energia-0101E0016

@Mina Andraws:
We support EK-TM4C123GXL and MSP-EXP430G2

Mahmoud Zidan

I installed the package but this error occurs when building the model
Error in 'TIVA123_communication/Digital Output': Initialization commands cannot be evaluated.
Caused by:
Error in S-function 'TIVA123_communication/Digital Output/Digital Output': S-Function 'arduinodigitaloutput_sfcn' does not exist


husam (view profile)

the setup keeps saying you didn't select a valid energia IDE path.
i am sure its not corrupted and in the right path

Mina Andraws

thank you for the great video.
but i have a question.
does it work with EK-TM4C1294XL ?

Islam Elnady

Will the package include PIL any time soon ? is there any alternatives ?


Hi Ahmed,

I have mentioned in the Setup and Configuration part of the documentation for energia support from Mathworks that there should be spaces between the path to downloaded Energia library.
Please keep the downloaded energia folder in some other directory without spaces.


Ahmad Tawfik

Am using matlab 2016a and am getting that error while deploying to hardware (gmake: *** [Tawfiks.o] Error 1
### Creating HTML report file Tawfiks_codegen_rpt.html
### Build procedure for model: 'Tawfiks' aborted due to an error.
Error(s) encountered while building "Tawfiks":
### Failed to generate all binary outputs.)

any idea how to solve it??

Ahmad Tawfik

@Callum Shipton what did you rename it cause am having the same issue and cannot solve it

Fixed the issue, had to rename the toolbox folder after installation but before running setup.p.

I am having a windows issue when deploying to hardware since in the makefile it is trying to include directories within the toolbox addon directory (which by default has spaces in the name, causing an error) Anyway I can specify the add-on to not be in a folder with spaces? I have tried renaming folder to have hyphens but then it can't find the files that are being specified somewhere.

Unable to see 'Digital Output' block in matlab simulink file, issue with MATLAB 2015b academic licence and Energia library installation.

Dan Lluch

Dan Lluch (view profile)

@Anil - adding to Peeyush's comment... Recommended approach for adding device drivers blocks is referenced inside various of the targets (but not Energia at this time) - here is one example -
That is the latest recommended approach - you can find other methods/examples on this File Exchange entry ( If you do create the block - please upload for the community. You will see many linked examples in the file exchange entry 39354.


@Anil : As of now, you will have to use Simulink blocks for this and generate code for Energia. You can use generated code in a s-function or system objects to create a single block for use. We are planning to add a support for this.


@Junaid: You will have to contact MathWorks install and setup help desk for this.

Anil Gupta

There is no simulink block available to read quadrature encoder.
so how do i read quadrature encoder using embedded coder target for energia and simulnik?
please help.

Junaid Zahid

I have Matlab 2015b academic version, but it is not supporting the embedded coder. May I know the problem please?


@Islam Elnady,

As of now External mode is supported for both MSP430 and TIVA. PIL is not supported yet.

Islam Elnady

Can I run a tiva c PIL with this package ?

Nick Mazzilli


I am getting errors running as admin on matlab 2016b with hardware board set, code generation system target at ert.tlc in C toolgain as energia tiva at faster runs. I am not quite sure if Nick and Jijing figured out the issue yet?

Thanks in advance for the help


LAG (view profile)


Thanks for the effort to support TI Tiva TM4C123. I was wondering if I could use the energia files as a template to crate a board support package for Simulink and Embedded Coder to use with TI Code Composer Suite v6 for the TI Tiva TM4C123 TM4C129 evaluation boards, etc.?

sajad rather

Thank You Peeyush,

Can you give me a hint of where i can find the wrapper code for Aurdino which makes it compatible with command line and can you provide some documentations links about the Wrapper code if possible.


@sajad: As I understand, you are looking for MATLAB command line APIs to directly talk to TIVA board like MATLAB does with Arduino . As of now the support for TIVA is via Simulink. Doing this in MATLAB is not supported directly. This will require creating MATLAB wrapper code to work with TIVA.

sajad rather

Hello Guys,

I do have a query regarding matlab configuration for TIVA tm4c123gxl Launchpad and Thanks to Mathsworks they have released embedded coder support for energia.
Well before going to TEXAS TIVA C series,let me tell you about my experience about Arduino compatibility with Matlab. Arduino works great with matlab command line as it has got all the packages to support matlab workspace.You can just read analog values or blink an led and much more stuff with a serial communication port at user defined baud rate.

Leaving the recent embedder coder package for energia aside,I just wonder why i am not able to communicate or read and write values to our TIVA MCU through command line through dedicated com port.

if Anybody has worked around it,kindly do the needful here.

for example i just want to read an analog sensor value connected to analog channel A0 in command line.

and please confirm if any package is needed for this communication.



@Nick and Jijing: I am not able to reproduce this issue on MATLAB R2016b. Can you tell me what is your system configuration and Operating systems details? Have you started MATLAB in the admin mode?

Nick Hunn

@Peeyush I have the same problem as Yan, running 2016b. Identical error. It has a good think about it, see attached screenshot:

Looks like a missing bracket somewhere.

Jijing Yan

@sanju, No, it doesn't work with Matlab 2015a

Jijing Yan

I wonder, how can I write a I2C package for Tiva C? Can somebody give some hints?


@jijing Yan: Could you elaborate more on the error? Are you running the Setup script and observe that installation process goes smoothly?


sadi (view profile)

Will it work on MATLAB 2015a?

Jijing Yan

Hi, very nice toolbox and example.thanks
But I have a problem by using the toolbox. I have installed all relevant software and drivers. By deploying to hardware it says always: Error(s) encountered while building "TIVA123_gettingstarted":
### Failed to generate all binary outputs.

Why? I am using Matlab 2016a. Can anyone help me? Thank you very much.



Bug fix for R2016b/R2017a. MATLAB restart was causing to failed download on hardware on these versions.


Added the video link in the description


Updated the documentation.


Enhancement of Setup script.


Added the Video link in Description


Updated doc


Updated the content

MATLAB Release
MATLAB 8.6 (R2015b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video