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.
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)
Short videos (2-3 min): Embedded Coder Overview, Targeting TI Piccolo
Joint TI / MathWorks Sessions:
Motor Control with Embedded Coder and TI C2000 (F28069)
MATLAB Speaks Hardware: TI C2000 for Digital Power Applications (F28377S)
Details and Examples:
C2000 Hardware Support webpages:
Delfino: F2833x, F2837xS, F2837xD, C2834x
Piccolo: F2802x, F2803x, F2805x, F2806x, F2807x, F28004x
Concerto: F28M35x, F28M36x (C28x + ARM Cortex M3)
Legacy: C280x, C281x, C2833x, F281x, F280x
C2000 Support Release Notes
TI Wiki: MATLAB and CCS compatibility matrix
Content Updated 2019-01-22
We are glad that we were able to resolve this issue, and will now proceed to close this thread.
If you have further questions related to this thread, you may click "Ask a related question" below. The newly created question will be automatically linked to this question.
In reply to Bob Hoffmann:
A message in a mailbox is transmitted only when the TRS bit of that mailbox is set. I presume your timer ISR sets the TRS bit. Therefore you see that message over and over again on the bus. Since this timer interrupt occurs at a more frequent rate than the other timer, messages from this MSGID "monopolize" the bus and does not let the other message get through. Perhaps you could have a software flag called "New_data". You set this flag when you have new data to transmit and clear this flag once the transmission is done. Your ISR should check this flag and initiate a transmit only when this flag is 1. To summarize, there is nothing abnormal with the behavior of the CAN module. The device is doing exactly what you are asking it to do.
If the issue is resolved, please close the forum post.
In reply to Hareesh J:
This is the natural behavior of CAN transceivers, they keep sending the last message stored in their buffer unless a new message comes in. The MCU laso sends the higher priority message first but if you set up your Simulink model correctly, I don't think you get the issue. Here is how I constructed my model in Simulink:
Inside the subsystem:
So as you can see I'm toggling two LEDs with 1 and 2 sec delay interval to make sure my subsystem is getting triggered, and transmitting two different messages over CAN with two different ID and Mailbox priorities as below:
1. Send "1" and increment it by 1 every 2 sec. MSGID: "111000111" (1C7) and Mailbox number: 2
2. Send "1" and increment it by 1 every 1 sec. MSGID: "111100111" (1E7) and Mailbox number: 3
Here is the result on CANalyzer:
As it's clear, both messages are being transmitted and their value is getting incremented.
Hope it helps you to find the issue in your model,
If my post answers your question, please click on "Verified answer".
In reply to Khashayar olia:
The default blocks in the C2000 library don't transmit continually, at least not in my implementation.
I suspect you are missing the ack bit, which can cause the transmitting node to continually attempt to resend the frame.
Finally, an acknowledgement (ACK) error occurs when SLLA109 4 A System Evaluation of CAN Transceivers the transmitter does not monitor a dominant bit in the ACK slot to signify that the message has been received properly by another node.
In a two-node experiment, if one node enters the bus-off state, the bus would become silent, or the other node would continue to retransmit until the reception of a proper ACK bit. Either case represents experimental conditions, causing a heavily disturbed bus that is not recommended for use in a final application.
What tool are you using to monitor the bus? If you are using a scope it will (in my experience) not send an ack bit. I think most monitor tools (CANalyzer etc.) will send the ack bit by default. Do you have another node on the bus? If not you will be missing the ack bit and in my past experience this can cause the transmitting node to continually attempt re-transmit. I saw this when using a scope to monitor a CAN bus and I needed to add a second node to stop the re-transmit.
The F28379D has two CAN busses. You could try connecting them together so the second one could be the "receiving" node and send the ack bit. I assume you are using a CAN transciever(s) and not simply looking at the Tx & Rx from the micro.
In reply to Donald Johnson:
Dear Don, I am indeed using a scope (with CAN decoding functionality) to monitor the bus, but I am pretty sure that this one does not send any ack bit. And as I was testing it as a single node setup, the described behavior of "the transmitting node to continually attempt to resend the frame" sounds like a plausible explanation. I am using the F28379D Launchpad development kit, which has only a single CAN transceiver on it. But I will simply connect two of the kits in order to test the hypothesis. Otherwise I might also find a CANanalyser somewhere in the lab. Thank you all for being so responsive!
Problem solved. With two nodes on the CAN bus the problem no longer appears. So I was indeed missing the ack bit.
I will be more careful with the correct "electrical" setup of the CAN bus for the final application.
Thank you for your help.
I have a question about using Mailboxes to transmit and receive CAN messages in Simulink. As far as I know I'm limited with 32 Mailboxes for CAN communication in Simulink. This means I can have up to 32 distinct CAN messages. I'm wondering if there is any way in Simulink to use the same Mailbox for multiple messages so I would be able to have more than 32 messages.
Based on TI expert, I can use Masking feature in CCS to use the same Mailbox for multiple messages. Can i use Masking feature in Simulink? if so, how do I use it?
I was thinking of making a library that contains eCAN_TX/eCAN_RX block and call it in my model when I'm ready for transmission.
I received an example of how to workaround this from my development team, but I cannot attach in E2e (file extension is not allowed). Here are their comments and a screenshot
In this example we are configuring the mask settings for mailbox – 0 to receive any message with standard identifier less than 256.
This mask configuration is done in the system initialize block as we don’t have a Simulink block to do the same. Thus with the mask settings, we can receive more than one message per mailbox thus overcoming the restriction of receiving only 32 distinct message.
DM me your email address and I can send file to you.
Brian McKay | Technical Marketing | www.mathworks.com
In reply to Brian McKay:
Trying to add attachment here as .zip. Ugly URL, so please let me know if it works correctly.
Thank you very much for your support.
That's funny but I solved it yesterday by myself and surprisingly my solution is exactly the same as your development teams :))), take a look at the below model, I toggle between two message every 1 sec:
I tested several approaches but it seems to be the only way to transmit several message with one Mailbox. I'm glad that my method is already approved by Mathwork development team. :)
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.