Using CAN database (CANdb or .dbc) files with OpenECU

Overview

CAN database files provide a great way to organize and manage your CAN network. In general, OpenECU is compatible with CANdb files. However, there are a few restrictions as described below.

To use a CANdb file in your model, go to the Simulink library browser and select Pi OpenECU -> Communication Drivers -> CAN Drivers to get to the CAN block library. From there, you can drag and drop one of our CANdb blocks into your model.

See the CANdb demo for an example.


Unsupported features

OpenECU currently does not support the following features of CANdb files:


Common questions and problems

We have gathered up a list of the most common support questions and problems and answered them below. We hope it helps.


Another ECU on my network stopped transmitting a message. How do I deal with that?

This is up to you to decide what is best for your application. You can implement a message time-out feature by using the rx_trig_flag output port.


What happens if more than one message of the same ID are received in a single model iteration?

In this case, the following will occur:


Error messages are popping up, and I don't know what they mean.

This usually happens when OpenECU cannot find your CANdb file.

This did not solve my problem


My signal is not being received correctly in OpenECU, but the signal looks right in my CAN bus monitoring software

We normally see this question in the situations listed below.

The signal looks good on the CAN bus, but I'm seeing strange numbers when I view the variable in my calibration tool

I have a boolean variable, but my calibration tool is showing 65 for TRUE, but FALSE is correctly showing 0

I have an enumeration, and the calibration tool is showing completely different values than my defined enums

In this situation, the common culprit is a mismatch between the signal data type and the data type defined in the data dictionary.

Here is how to solve the issue:

  1. Check your signal data type. The easiest way to turn on the Port Data Type display in your Simulink model, and either re-build the model or update the diagram (ctrl-D when your model is the active window).
  2. Next, check the signal data type against what is defined in the data dictionary.
  3. If the types do not match, change one or the other to match.
    1. If the data dictionary is correct, you can insert a Data Type Conversion block (found in the Signal Attributes library) to convert the signal to the correct type.

    2. If the signal is the correct type, change the signal type in the data dictionary.

This did not solve my problem


The signal looks good on the CAN bus, but OpenECU is always showing 0

or

The signal looks good on the CAN bus, but it is clipped by OpenECU

The usual cause for these two issues is due to the "Clip Signals To Engineering Limits" feature of the pcx_CANdb_ReceiveMessage block. To determine if this is an issue, do the following:

  1. Double click the pcx_CANdb_ReceiveMessage block that is having the problem. That will open up the block dialog as shown below.

CANdbClip.jpg

  1. Check if "Clip Signals To Engineering Limits?" is ticked (see red circle above). If so there are two options:
    1. Un-tick the "Clip Signals To Engineering Limits?" check box. OR
    2. Check the signal limits in the CANdb file (described below).
  2. Open your CANdb file in your CANdb editor.
  3. Find the problem signal and double-click it to open the signal editor. It should look like the following:

CANdbSignalClip.jpg

  1. Change the Minimum and Maximum values (circled in red above) to the correct values.

If you are still experiencing issues, double check your model for the following:

  1. The signals are all connected to the correct ports
    • Be careful of crossing or overlapping signal lines
  2. Be sure the signal properties are set to "Exported Global" so the calibration tool can find the variable.
  3. Be sure the signal is properly defined in the data dictionary.

  4. Be sure the name of the signal matches the name in the data dictionary.
    • We recommend copy/paste instead of typing in both locations.

This did not solve my problem


I recently changed the signal order (or added/removed signals) in my CANdb file, and now the signals are not being received/transmitted correctly

In this situation, the block works properly, but it may not work how you are used to Simulink working.

Behavior you are accustomed to

If you have a Subsystem block and you re-order the ports, Simulink automatically re-routes the wires outside of the Subsystem block to keep the port connections correct.

OpenECU block behavior

Simulink will not automatically re-route the wires to OpenECU blocks.

Summary

If you ever add, remove, or re-order signals in a message, you must re-check the signal wiring into your block.

This did not solve my problem

      Copyright © 2016 Pi Innovo, All rights reserved