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.

LAUNCHXL-F28379D: CAN Communication using Simulink

Part Number: LAUNCHXL-F28379D

Hello there!

I'm new to the C2000 µC Family and I really like the good Support by Matlab and Simulink. I have deployed all my algorithms to the C2000 and it seems to work fine so far. I now want to use CAN communication to read and write some variables and data in my Simulink model. Therefore I'm using Vector Software.

At first I tried to Transmit some data via CAN to Vectors CANoe, which worked fine with some Signals. Unfortunately the eCAN Transmit block only accepts type uint values. For negative Signals this is a Problem. First question: do you know how to use the eCAN Transmit block when using also signed singals?

Then I tried to Receive a CAN Signal, to set variables for example. Unfortunetly this is an 8 Byte length vector as Output. What is the architecture of this vector?

Then I found an Simulink example using the CCP block. It seems to me that definded Paramters and Signals are send and recieved via CAN using this block. I have an a2l and a hex generated when Building the model. I thought I can use it for Vectors CANape maybe. But unfortunately I cannot connect to the board somehow. There is no CAN stream also, when compiling the Simulink example. (link to the example: )

Maybe you can give me a little help for starting here :)

  • I working to get some better answers. You can always get immediate help by contacting MathWorks Tech Support.

    As far as the CAN blocks, they do only take uint. I think for negative values, you may have to software scale your signal into uint, encode into CAN transmit, decode the CAN receive, and then software scale back to your negative number range.

    If I get anything more, I'll post it.

    Cheers,

    -Brian

  • Some other suggestions I got from a colleague in Development:

    1. Use 'c2000lib/Target Communication/CAN Pack' block to pack different types of signals. This will support signed signals and also support CAN database.
    2. CAN Receive block output dimension will depend on the datatype selected. If you select the data type as uint8 then it will output a signal of size 8, which will have 8 data bytes of the CAN message. You can use CAN Unpack block from above library to unpack different types of signals.
    3. CCP external mode is supported for communicating with Simulink. But he can use CCP block to communicate with CANape tool. You can build the model with CCP block and download to the target and then load a2l file in CANape tool and then communicate. Other customers are using this workflow.

    That's all the help I can provide. Please contact MW Tech Support for additional assistance - as they don't monitor the TI forums.

    Cheers,

    -Brian