# Documentation of CAN messages

CMM-2CH and CMM-3CH can be controlled via CAN-FD. Each measurement channel has its own microcontroller. The nominal baudrate is 1 MBit/s, the data baudrate is 4 MBit/s. A DBC file is available on the [download page](https://downloads.irs.systems/?sku=12).

## Structure of CAN-IDs

The CAN IDs are build with the following scheme.

<table><thead><tr><th width="89">Bit</th><th width="137.66668701171875">Mask</th><th width="131.3333740234375">Content</th><th>Comment</th></tr></thead><tbody><tr><td>28</td><td>0x10000000</td><td>Direction</td><td>0: PC to uC, 1: uC to PC</td></tr><tr><td>27-20</td><td>0x0FF00000</td><td>Command-ID</td><td>0...255 see section <a href="#list-of-can-commands">Commands</a></td></tr><tr><td>19-12</td><td>0x000FF000</td><td>Module-ID</td><td>"M" = 0x4D</td></tr><tr><td>11-4</td><td>0x00000FF0</td><td>Board-ID</td><td>0...31 (Can be set via DIP switch on CMM-2CH), 255 = 0xFF = broadcast to all boards</td></tr><tr><td>3-0</td><td>0x0000000F</td><td>Channel-ID</td><td>0...2 (Is hardwired on CMM-xCH), 15 = 0xF = broadcast to all channels</td></tr></tbody></table>

The highest value of board (0xFF) and channel (0xF) is used as broadcast.\
For example the ID 0x 0 00 4D 01 F is the command "SetOnOff" (= 0x01) for all channels on board 1.

## List of CAN-Commands

Physical values are always transmitted as float (32 Bit / Single Precision / LSB first) and in the base unit (V / A / sec / °C / ... ).

### CAN-IDs to set and get register style values

Get-ID and Response-ID are the same, because the already differ in the direction bit 28. The command values in the following table include the direction bit, to make this clear.

<table><thead><tr><th width="80">Set-ID</th><th width="80.66668701171875">Get-ID</th><th width="110">Response-ID</th><th width="174.3333740234375">Command</th><th width="61">DLC</th><th>Data</th></tr></thead><tbody><tr><td>-</td><td>-</td><td>0x140</td><td>CommandResponse</td><td>2</td><td>StatusCode (U8), Command (U8)</td></tr><tr><td>0x001</td><td>0x041</td><td>0x141</td><td>OnOff</td><td>1</td><td>OnOff [0/1] (U1)</td></tr><tr><td>0x002</td><td>-</td><td>-</td><td>OnOffSelected</td><td>1</td><td>EnableMask_Board (U8)</td></tr><tr><td>0x003</td><td>0x043</td><td>0x143</td><td>MinRange</td><td>1</td><td>MinRange (U8)</td></tr><tr><td>0x004</td><td>0x044</td><td>0x144</td><td>MinMaxAvg</td><td>24</td><td>CurrentMin [A] (float), CurrentAvg [A] (float), CurrentMax [A] (float),</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>VoltageDropMax [V] (float), NoOfSamples (U32), RangeMin (U8), RangeMax (U8)</td></tr><tr><td>0x005</td><td>0x045</td><td>0x145</td><td>ChannelConfig</td><td>5</td><td>OnOffDefaultValue [0/1] (U1), MeasuredValuesInterval [sec] (float)</td></tr><tr><td>0x006</td><td>0x046</td><td>0x146</td><td>CanConfig</td><td>3</td><td>TxFrameFormat [Enum] (U8), NominalBaudrate [Enum] (U8), DataBaudrate [Enum] (U8)</td></tr><tr><td>0x007</td><td>0x047</td><td>0x147</td><td>LegacyConfig</td><td>16</td><td>LocalId (U32), LocalIdIsExt (U1),RemoteId (U32), RemoteIdIsExt (U1)</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>LegacyCyclicId (U32), LegacyCyclicIdIsExt (U1), LegacyCyclicMessageEnable (U1)</td></tr><tr><td>-</td><td>0x048</td><td>0x148</td><td>Version</td><td>12</td><td>HardwareType (U8), FirmwareVersion (U16), CompileTimestamp (U32),</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>WarningRegister (U16), HardwareVersion (U8)</td></tr><tr><td>-</td><td>0x049</td><td>0x149</td><td>SerialNumber</td><td>12</td><td>SerialNumber (String 12 Bytes)</td></tr><tr><td>0x00A</td><td>-</td><td>-</td><td>RestoreDefault</td><td>0</td><td>-</td></tr><tr><td>0x00D</td><td>0x04D</td><td>0x14D</td><td>DisableCalibration</td><td>1</td><td>DisableCalibration [0/1] (U1)</td></tr></tbody></table>

#### Status codes

<table><thead><tr><th width="134.00006103515625">Code</th><th>Description</th></tr></thead><tbody><tr><td>0xA0</td><td>Success</td></tr><tr><td>0xE0</td><td>Unknown command</td></tr><tr><td>0xE1</td><td>Invalid DLC</td></tr><tr><td>0xE2</td><td>Parameter out of range</td></tr><tr><td>0xE3</td><td>Flash error</td></tr><tr><td>0xE4</td><td>Flash verify error</td></tr><tr><td>0xE5</td><td>Command not allowed</td></tr><tr><td>0xE6</td><td>Firmware hardware mismatch</td></tr><tr><td>0xE7</td><td>File not found</td></tr></tbody></table>

#### Values in WarningRegister

| Name                         | Value  |
| ---------------------------- | ------ |
| WARNING\_CANRXFIFOFULL       | 0x0001 |
| WARNING\_CANTXFIFOFULL       | 0x0002 |
| WARNING\_CANBUSOFF           | 0x0004 |
| WARNING\_INVALIDCALIBRATION  | 0x0008 |
| WARNING\_DISABLEDCALIBRATION | 0x0010 |
| WARNING\_ISOTPRXFIFOFULL     | 0x0020 |

### Cyclic CAN-IDs uC -> PC

Physical values are always transmitted as float (32 Bit / Single Precision / LSB first) and in the base unit (V / A / sec / °C / ... ).

<table><thead><tr><th width="117.66668701171875">Command-ID</th><th width="172">Name</th><th width="85">DLC</th><th>Data</th></tr></thead><tbody><tr><td>0x180</td><td>MeasuredValues</td><td>12</td><td>Current [A] (float), Range (U8), VoltageDrop [V] (float), OnOff [0/1] (U1)</td></tr><tr><td>0x18E</td><td>ErrorHandler</td><td>48</td><td>ErrorType (U8), FileNumber (U8), LineNumber (U16), more info</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.irs.systems/cmm-3ch/general/can-protocol-en.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
