File Exchange

image thumbnail

Embedded Coder Target for Energia

version 1.6 (1.74 MB) by MathWorks Embedded Coder Team
Support for low cost Texas Instruments LaunchPads

30 Downloads

Updated 08 Jan 2019

View License

Energia (www.energia.nu) 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.
https://www.youtube.com/watch?v=ktn1UKEr87s

Cite As

MathWorks Embedded Coder Team (2020). Embedded Coder Target for Energia (https://www.mathworks.com/matlabcentral/fileexchange/54929-embedded-coder-target-for-energia), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (61)

msh jgtu

I am trying to do hardware in the loop using Tiva c 123 with matlab 2018a but i got error when i try to build the model . I have embedded coder target and energia IDE, the error is

arm-none-eabi-g++: error: tiva: No such file or directory
arm-none-eabi-g++: error: c/energia-0101E0016/hardware/lm4f/cores/lm4f/lm4fcpp_blizzard.ld: No such file or directory
gmake: *** [../untitled.elf] Error 1
### Creating HTML report file untitled_codegen_rpt.html
### Build procedure for model: 'untitled' aborted due to an error.
Error:Error(s) encountered while building "untitled":
### Failed to generate all binary outputs.
Caused by:
Validation error(s):
MEX Tool: Cannot find file 'F:\\matlab2018files\\bin\\mex.exe'. The file does not exist.

Hitesh B

How do we get hardware support for MSP430 ?

Martin Petrovic

Saipraveen

@BS, Hi. Could you elaborate further? If you need to visualize or log signals from the hardware you can run the model in external mode, that would use the serial communication via USB to transfer data from the hardware to the host computer.

BS

How can you measure some signals over the time in real time ?
Which SW and external HW is needed?

@Mohammed Setti, Hi. One way to verify the digital input block is to connect it’s output to a digital output block.
Change the state of the pin to which the input block is configured and that should drive an output pin and probably toggle a LED in effect.

Mohammed SETTI

Hello,
Could you please tell me how to use digital input block in the case of MSP-EXP430G2 Launchpad?

@owais, Hi. The PWM frequency is approximately 490Hz.

owais hurrah

How much pwm frequency can i get on MP430

Saipraveen

@Om, Hi. From the support package file path, just type "Setup" in the command window & that should run the file.

OM MAURYA

Hi, Could you tell me how to run setup.p file as in video tells about setup.m file??

Saipraveen

@March, Hi. The frequency of the PWM on the analog output pins is approximately 490Hz.

Saipraveen

@Conner, Hi. This target includes support for Tiva TM4C123G and MSP-EXP430G2 LaunchPads with Simulink.

Conner Futa

Is the TM4C1294XL also supported by this add on?

MARCH KHEE HIN LEONG

hi @nilgun,
im unable to change the frequency of the pwm?

rohan sagar

Nevermind I Figured it out. When it prompts to select the folder. Press command+shift+G and enter
/Applications/Energia.app/Contents/Resources/Java
You cannot navigate beyond Applications as it only allows you to select folders and Energia.app is not one.

nilgun sever

Hi @Venkatesh,

Thank you for the answer. But, I take the following error now:

Error evaluating 'InitFcn' callback of Energia Digital Output block (mask) 'MSP430G2553_gettingstarted/Digital Output'.
Callback string is 'codertarget.commonbase.blocks.arduinoBlockInitFcnCallback(gcbh);'
Caused by:
Undefined variable "codertarget" or class "codertarget.commonbase.blocks.arduinoBlockInitFcnCallback".

Regards,
Nilgün

nilgun sever

@Venkatesh, my MATLAB version is R2018b.

Venkatesh Chilapur

Hi,
@nilgun, which version of Matlab is being used? Did you try to download the project now and try to install once more. We have made updates to this package for the below error.

nilgun sever

Hello,
The similar error that was asked by @▲Anas ,s appearing for MSP430 launchpad as well. The error is as follows and I don't understand the main reason of it:
"The 4th right hand argument, FLAG, passed to MEX level2 S-function "arduinodigitaloutput_sfcn" must be an integer"
Have you managed to fix the issue? If not, how can I use MSP430 kit with my Simulink model?

Hi,
why all my model files that I created previously in Simulink R2016b by Energia Support Package were deleted from my computer when I also installed Energia Support Package in Simulink R2017b? And how can I possibly get or recover them if they are not completely deleted, but maybe just relocated?

Venkatesh Chilapur

Hi Tam,

You can use S-Function or System Object approach to create a driver block.
Here are few reference that can be handy.
https://in.mathworks.com/matlabcentral/fileexchange/41645-raspberry-pi-quadrature-encoder-sfunction
https://in.mathworks.com/help/supportpkg/raspberrypi/device-driver-blocks.html

Tam Tue

Hi, can you create a block that uses the QEI module?

Venkatesh Chilapur

@Anas Salem.. Thank you for reaching out to us. We are already aware of this issue and working to fix it. In the meantime we can provide few patch file to you, for that please can you contact us at: https://www.mathworks.com/support/contact_us.html

Hi all,
I was trying to run the provided example from Engeria "TIVA123_gettingstarted" file after I did all the installations and setup. I have MATLAB R2018a. I got this error:

(Error in 'TIVA123_gettingstarted/Digital Output1': Initialization commands cannot be evaluated.
Caused by:
Error while obtaining sizes from MEX S-function 'arduinodigitaloutput_sfcn' in 'TIVA123_gettingstarted/Digital Output1/Digital Output'.
The 4th right hand argument, FLAG, passed to MEX level2 S-function "arduinodigitaloutput_sfcn" must be an integer)

Can anyone tell me how to resolve that?

bharath h p

Hi,
If i run the model, i am getting this error: "Error evaluating 'InitFcn' callback of Energia Digital Output block (mask) 'MSP430G2553_gettingstarted/Digital Output'", How to resolve this error?

Antonin

Hi Antscran,

We are taking advantage of the fact that Energia is a pure copy of Arduino. Some of the internal files are even named after Arduino, only the color changes. This allows us to reuse most of the solution that we have created for Arduino.

Antscran

I am curious how this differs from the Arduino support package, with regards functionality?

Venkatesh Chilapur

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

Venkatesh Chilapur

@husam: Please use IDE energia-0101E0016

Venkatesh Chilapur

@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

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 ?
thanks

Islam Elnady

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

Peeyush

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.

Thanks,
Peeyush

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

Callum Shipton

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

Callum Shipton

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.

Shubhangi Tewari

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

Dan Lluch

@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 - https://www.mathworks.com/help/supportpkg/arduino/device-driver-blocks.html
That is the latest recommended approach - you can find other methods/examples on this File Exchange entry (https://www.mathworks.com/matlabcentral/fileexchange/39354-device-drivers). If you do create the block - please upload for the community. You will see many linked examples in the file exchange entry 39354.

Peeyush

@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.

Peeyush

@Junaid: You will have to contact MathWorks install and setup help desk for this.
https://www.mathworks.com/company/aboutus/contact_us.html

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

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

Peeyush

@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

Peeyush,

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

Peeyush,

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.

Peeyush

@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.

Thanks.

Peeyush

@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:
http://i.imgur.com/JAICjwa.png

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?

Peeyush

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

sadi

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.

Updates

1.6

Updated Driver Block Mex files making this package compatible with MATLAB release 18a and above.

1.5

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

1.4.0.0

Added the video link in the description

1.3.0.0

Updated the documentation.

1.2.0.0

Enhancement of Setup script.

1.1.0.0

Added the Video link in Description

1.1.0.0

Updated doc

1.0.0.0

Updated the content

MATLAB Release Compatibility
Created with R2015b
Compatible with R2015b to any release
Platform Compatibility
Windows macOS Linux