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.

SW-EK-TM4C123GXL: TIVA TM4C123GXL MATLAB CONFIGURATION

Part Number: SW-EK-TM4C123GXL
Other Parts Discussed in Thread: ENERGIA, CC3100, CC3200

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

  • Your best support for Matlab questions will come from Mathworks. Here is the getting started link: http://www.mathworks.com/matlabcentral/fileexchange/54929-embedded-coder-target-for-energia

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

  • Thanks Peeyush for the info regarding same,



    As you are from Mathworks,

    Please clarify the following two queries

    As i started using the embedder coder for energia ,i am always facing the problem in pin assignment for ADC and PWM .I don't know weather its happening with everyone or just me.

    1. For example whenever i try to take the pwm block and want to set the pin no as 30 to it(same pin as of Red LED on board),it always returns an error that you cannot use this pin and gives the number of pins you can assign to this block.The confusion here is why its not supporting the pin 30,Pin 30 has PWM functionality also if you see the datasheets or Energia sketches around.Even same happens in case of ADC configuration.

    2.Second thing I want to ask you that as there is no I2C and WIFI support within the embedded coder for energia, so can we modify the simulink wifi blocks of aurdino somehow ,so as they can work with TIVA and MSP430 too for TEXAS instruments wifi modules(CC3100 and CC3200) .Also the wifi modules from texas are comfortable with enegia, one can program the board for any wifi application and few wifi based examples are there in energia itself under wifi librariesis.
    it would be great if Mathworks can give this support also from Simulink.

    Kindly help me out

    Thank You

    Rather
  • Hello Peeyush,

    Any update on my queries,

    Well if i am not wrong,

    As far as i dig out the issue,i found that the blocks under Embedder Coder for Energia are same as that of Aurdino blocks having Same configuration too,which is very unfortunate.

    As both the boards have different pinout for programming.So this coder cannot support all the pins on TI boards(TIVA & MSP430). Using ADC with analog read block will give always wrong results as it is set to measure from 0-1023 as of aurdino and we have ADC as 12bit in TIVA which needs to go from 0-4095 .same is the case with PWM and other pins .

    Kindly help here to sort out the issue.

    Thank you.

    Rather

  • Limitations you (properly) report and (rightfully protest) suggest a "name change" is in order - perhaps (as I've heard) - "Low/Compromised/Slight-energia" better reflects, "capability & promise?"

  • Hi Sajad,

    Apologies for the late reply. I am addressing issues pointed by you as below:

    - I do not see any issues with PWM block where you are not able to use Pin 30. You should be able to use Pin 30 for PWM. I have not restricted anything as such for the same. I cross verified this at my end and it works.

    - The idea behind Energia support is to make it analogous to Arduino support and I am sure even TI follows that, Energia is basically a replica of Arduino and we have made sure that it is compatible with Arduino blocks. Ideally all examples of Arduino works same on Energia, irrespective of the hardware:

    In the above link you would observe resolution for ADC as 0-1023, eventhough there are hardware with better ADC resolution at both sides Arduino and Texas Instruments.

  • Hello Peeyush,

    Let me start from the very begining,I have attached the Energia Pinout for Tiva Below

    As you can see multiplexed pins for launchpad for example the Pins Start from A0- A11 are all analog pins and similiraly you can find the pins for PWM ,UART and other functionality as well.

    Using Energia to program the launchpad if we follow this Pinout Structure you can program those all pins in what configuration we want.Now as matlab has embedded coder for energia, so it should work the same way as energia but as i try to assign the pins only few work for PWM and for ADC too.

    Please look into the following Attachments and the error displayed ,(As far as i can say it recognizes the TIVA LAunchpad but takes the Pinout of Aurdino Style).

    Here above i try to use pin no 29 as analog pin but it displays error  that you can only use 2- 13 no  pins for analog read,and for tiva only few pins are having analog function on these pin nos,and rest analog functionality is on others which it doeskin take.

    And in this one i am trying to configure the Pin30 which is having PWM functionality in it.But it displays error as shown in figure above.

    I think the  matlab S-function for these modules need to be edited as per the TIVA pinout for Energia.

    Thank You

    Rather Sajad

  • Hi Sajad,

    I understand the issue you are facing. However I have taken care of this constraint for Energia, eventhough it depends on Arduino S-functions. I thought if it is overlapping with Arduino support from Simulink and thus installed Arduino support package as well. Still I am not able to reproduce the issue. Make sure you are using the latest Energia Support from file exchange.

    Ideally it should throw error if Pin entered is out of 2:53 range.

    Thanks,

    Peeyush

  • Hello peeyush,

    Thank for getting back to me,

    I resolved this issue on my end.

    Now can you help me in reading an I2C ADXL accelrometer with tiva using those blocks,I know there is no I2C blocks for Energia support but people have already done it on Arduino IDE when I2C block was not available in aurdino package.They have used S-functions to create it,Kindly look into the video in following link

    www.youtube.com/watch


    I tried to do same but some of the files are missing in Energia library or probably renamed.

    Kindly do the needful here.

    Regards

    Sajad Rather
  • Hi,

    Please see this link - people there use I2C from Tiva; a lot of other solutions can be found there.

  • Hello peteri,

    Thank you for your response on my post,

    The thing is i wanted to do this I2C using Matlab Simulink, it seems have to do some reading on it as its seems new to everyone.

    Anyway posted my query over there too,

    Regards 

    Rather

  • Hi Sajad,

    As the prototype for Arduino is readily available on:

    This should not be difficult to do it on Energia, as you would like to use same S functions on Energia.

    The below guide can help you in order to find how to create s functions wrappers drivers for Simulink:

    www.mathworks.com/.../39354-device-drivers

    Let me know if you need any clarifications.

    Thanks,

    Peeyush

  • Thank you peeyush

    I will go through the link,Simulink S-functions are new to me,

    will update you accordingly.

    Thank you