Custom Models (CDX)

A CD6 can run a custom model: your own application, generated from a Simulink® model or written in C, on a processor reserved for it. The model works alongside the display setup. It does not replace it. The CDX Model Runtime is the software you build the model with: a runtime library, public API, build tools and the cdx command-line interface.

What Models Are For

The CD6 has two processor cores. The display firmware runs on the Cortex-M7. It does everything configured in a Dash Design setup: inputs, channels, CAN, screens, logging and outputs. The Cortex-M4 is reserved for a custom model.

A Dash Design setup covers most display needs without any programming. Add a model when you need more than the setup’s channel, maths and logic features provide, for example:

  • Control and strategy logic developed in Simulink and generated with Embedded Coder, such as launch, shift or traction strategies, or requests to other ECUs.
  • Complex calculations, such as estimators, virtual sensors, filters, state machines and diagnostics.
  • Deterministic timing. The model steps at a fixed period, such as 1 ms, independently of screen rendering. It can read analogue inputs with low latency and send urgent frames directly on physical CAN.
  • Tunable parameters. You can calibrate them over XCP and store them in the display.

How a Model Works With the Dash

flowchart LR
    inputs["CD6 inputs and<br/>external CAN"] --> dash["Display firmware (CM7)<br/>runs the Dash Design setup"]
    dash -->|"channel values<br/>(Model IPC)"| model["Your model (CM4)<br/>CDX runtime"]
    model -->|"results as<br/>new channels"| dash
    dash --> outputs["Screens, logging, LEDs,<br/>outputs and external CAN"]
    model -.->|"urgent CAN transmit"| can["Physical CAN1/CAN2"]
  1. The setup sends selected channel values to the model over Model IPC, a virtual CAN connection between the two cores.
  2. The runtime calls your model’s step function at a fixed period.
  3. The model’s results return over Model IPC and become ordinary dash channels. The setup can display, log, test or forward them on external CAN, like any other channel.

Two DBC files define the signals exchanged. The build packages them with the model firmware into a .cdxmodel file. Loading the file into a Dash Design setup creates the matching channels. Uploading the setup programs the model with it.

What You Need

Item Notes
CD6 display With firmware that supports the model runtime.
GEMS Dash Design A release with CDX Model support. See Configuring with Dash Design.
CDX runtime release cdx-runtime-<version>.zip, from GEMS.
Arm compiler, CMake, Ninja Installed by the runtime’s install-tools script. See Installing Tools.
GEMS Ginmake Licensed. Generates the IPC code from the DBC files.
MATLAB, Simulink, Embedded Coder Optional. Only to generate code from your own Simulink models.

Learning Path

Work through these pages in order:

  1. Quickstart: Hello World: build the starter application and run it on a CD6. No MATLAB needed.
  2. Application Template: how the starter works and how to connect your own model code.
  3. Model Integration: how Model IPC, DBC directions, callbacks and calibration connect a model to the dash.
  4. Simulink Projects: set up a Simulink model to build with cdx build or Dash Design’s CDX Project Tools. The Simulink Bench example is a complete project.
  5. Using the Model API: callback rules, fast I/O, urgent CAN and the lower-level functions. The API Reference lists every declaration.

For reference:

What a Model Can Access

The public CDX interface is a model interface, not a peripheral-driver API. The display firmware owns the hardware. A model reaches it through dash channels or the functions below.

Hardware capability Public CD6x model API
Two physical CAN/CAN-FD interfaces One virtual CDX_CAN_BUS_ID_IPC over Model IPC. cdx_fast_io.h also supports urgent physical CAN transmission through CM7. No bitrate or termination configuration
Display, cameras and LEDs No rendering, camera or LED-control functions
Analogue, speed, button and beacon inputs cdx_fast_io.h provides ADC snapshots and cached analogue input getters. No direct speed, button or beacon acquisition
Low-side drivers and sensor supply No direct output-control functions
Ethernet, RS232, USB and logging No socket, serial, USB or log-storage functions
RTC and IMU No direct RTC/IMU functions. API timestamps are local elapsed time, not calendar time
XCP-Ethernet in the hardware specification No model-network API. CM7 serves model XCP on a configured external CAN interface

The sole model bus, CDX_CAN_BUS_ID_IPC, maps to the dash’s Model IPC/CAN3 channel. The legacy CDX_CAN_BUS_ID_CAN1 name is an alias for that virtual bus, not access to the dash’s external CAN1 connector. Model IPC has no external connector or CM4 CAN controller.

CM7 manages external CAN for dash communications and XCP. Signals can be forwarded through dash channels between external CAN messages and the virtual Model IPC messages. Configure those routes in Dash Design. The Model IPC API does not select either physical CAN interface. For urgent physical CAN transmission through CM7, use cdx_fast_io.h. See Model IPC Messages.