@zimo-elektronik/zcan 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +7 -0
- package/.editorconfig +15 -0
- package/.eslintignore +7 -0
- package/.eslintrc.cjs +17 -0
- package/.gitattributes +1 -0
- package/.github/workflows/docs.yml +46 -0
- package/.github/workflows/library.yml +59 -0
- package/.nvmrc +1 -0
- package/.prettierignore +14 -0
- package/.prettierrc.json +8 -0
- package/LICENSE.md +21 -0
- package/README.md +8 -0
- package/__tests__/connection.test.ts +58 -0
- package/__tests__/dataGroup.test.ts +98 -0
- package/__tests__/infoGroup.test.ts +30 -0
- package/__tests__/lanDataGroup.test.ts +82 -0
- package/__tests__/lanInfoGroup.test.ts +41 -0
- package/__tests__/systemControlGroup.test.ts +42 -0
- package/__tests__/trackCfgGroup.test.ts +43 -0
- package/__tests__/util/index.ts +14 -0
- package/__tests__/vehicleGroup.test.ts +128 -0
- package/dist/@types/communication.d.ts +30 -0
- package/dist/@types/communication.js +2 -0
- package/dist/@types/communication.js.map +1 -0
- package/dist/@types/models.d.ts +172 -0
- package/dist/@types/models.js +2 -0
- package/dist/@types/models.js.map +1 -0
- package/dist/MX10.d.ts +45 -0
- package/dist/MX10.js +233 -0
- package/dist/MX10.js.map +1 -0
- package/dist/docs_entrypoint.d.ts +6 -0
- package/dist/docs_entrypoint.js +7 -0
- package/dist/docs_entrypoint.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/bites.d.ts +9 -0
- package/dist/internal/bites.js +10 -0
- package/dist/internal/bites.js.map +1 -0
- package/dist/internal/speedUtils.d.ts +9 -0
- package/dist/internal/speedUtils.js +29 -0
- package/dist/internal/speedUtils.js.map +1 -0
- package/dist/internal/utils.d.ts +1 -0
- package/dist/internal/utils.js +4 -0
- package/dist/internal/utils.js.map +1 -0
- package/dist/util/enums.d.ts +113 -0
- package/dist/util/enums.js +137 -0
- package/dist/util/enums.js.map +1 -0
- package/dist/util/extended-ascii.d.ts +7 -0
- package/dist/util/extended-ascii.js +162 -0
- package/dist/util/extended-ascii.js.map +1 -0
- package/dist/zcan/accessoryCommandGroup.d.ts +6 -0
- package/dist/zcan/accessoryCommandGroup.js +9 -0
- package/dist/zcan/accessoryCommandGroup.js.map +1 -0
- package/dist/zcan/dataGroup.d.ts +31 -0
- package/dist/zcan/dataGroup.js +233 -0
- package/dist/zcan/dataGroup.js.map +1 -0
- package/dist/zcan/fileControlGroup.d.ts +7 -0
- package/dist/zcan/fileControlGroup.js +9 -0
- package/dist/zcan/fileControlGroup.js.map +1 -0
- package/dist/zcan/fileTransferGroup.d.ts +7 -0
- package/dist/zcan/fileTransferGroup.js +9 -0
- package/dist/zcan/fileTransferGroup.js.map +1 -0
- package/dist/zcan/index.d.ts +18 -0
- package/dist/zcan/index.js +19 -0
- package/dist/zcan/index.js.map +1 -0
- package/dist/zcan/infoGroup.d.ts +15 -0
- package/dist/zcan/infoGroup.js +64 -0
- package/dist/zcan/infoGroup.js.map +1 -0
- package/dist/zcan/lanDataGroup.d.ts +23 -0
- package/dist/zcan/lanDataGroup.js +226 -0
- package/dist/zcan/lanDataGroup.js.map +1 -0
- package/dist/zcan/lanInfoGroup.d.ts +11 -0
- package/dist/zcan/lanInfoGroup.js +58 -0
- package/dist/zcan/lanInfoGroup.js.map +1 -0
- package/dist/zcan/lanNetworkGroup.d.ts +11 -0
- package/dist/zcan/lanNetworkGroup.js +37 -0
- package/dist/zcan/lanNetworkGroup.js.map +1 -0
- package/dist/zcan/lanZimoProgrammableScriptGroup.d.ts +7 -0
- package/dist/zcan/lanZimoProgrammableScriptGroup.js +9 -0
- package/dist/zcan/lanZimoProgrammableScriptGroup.js.map +1 -0
- package/dist/zcan/networkGroup.d.ts +10 -0
- package/dist/zcan/networkGroup.js +38 -0
- package/dist/zcan/networkGroup.js.map +1 -0
- package/dist/zcan/propertyConfigGroup.d.ts +7 -0
- package/dist/zcan/propertyConfigGroup.js +9 -0
- package/dist/zcan/propertyConfigGroup.js.map +1 -0
- package/dist/zcan/railwayControlGroup.d.ts +7 -0
- package/dist/zcan/railwayControlGroup.js +9 -0
- package/dist/zcan/railwayControlGroup.js.map +1 -0
- package/dist/zcan/systemControlGroup.d.ts +13 -0
- package/dist/zcan/systemControlGroup.js +35 -0
- package/dist/zcan/systemControlGroup.js.map +1 -0
- package/dist/zcan/trackCfgGroup.d.ts +16 -0
- package/dist/zcan/trackCfgGroup.js +77 -0
- package/dist/zcan/trackCfgGroup.js.map +1 -0
- package/dist/zcan/trainControlGroup.d.ts +8 -0
- package/dist/zcan/trainControlGroup.js +19 -0
- package/dist/zcan/trainControlGroup.js.map +1 -0
- package/dist/zcan/vehicleGroup.d.ts +26 -0
- package/dist/zcan/vehicleGroup.js +145 -0
- package/dist/zcan/vehicleGroup.js.map +1 -0
- package/dist/zcan/zimoProgrammableScriptGroup.d.ts +7 -0
- package/dist/zcan/zimoProgrammableScriptGroup.js +9 -0
- package/dist/zcan/zimoProgrammableScriptGroup.js.map +1 -0
- package/gulpfile.js +37 -0
- package/jest.config.js +26 -0
- package/package.json +50 -0
- package/protocol_docs/README.md +41 -0
- package/protocol_docs/babel.config.js +3 -0
- package/protocol_docs/docs/command-groups/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/accessories/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/accessories/accessory-state.md +7 -0
- package/protocol_docs/docs/command-groups/command-groups.md +50 -0
- package/protocol_docs/docs/command-groups/data/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/data/data-name-extended.md +60 -0
- package/protocol_docs/docs/command-groups/data/group-count.md +52 -0
- package/protocol_docs/docs/command-groups/data/item-fx-info.md +27 -0
- package/protocol_docs/docs/command-groups/data/item-image-config.md +44 -0
- package/protocol_docs/docs/command-groups/data/item-list-by-index.md +45 -0
- package/protocol_docs/docs/command-groups/data/item-list-by-nid.md +43 -0
- package/protocol_docs/docs/command-groups/data/remove-train.md +33 -0
- package/protocol_docs/docs/command-groups/info/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/info/bidi-info.md +34 -0
- package/protocol_docs/docs/command-groups/lan-data/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/lan-data/data-value-extended.md +65 -0
- package/protocol_docs/docs/command-groups/lan-data/loco-gui-extended.md +48 -0
- package/protocol_docs/docs/command-groups/lan-info/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/lan-info/module-power-info.md +26 -0
- package/protocol_docs/docs/command-groups/lan-network/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/lan-network/open-port.md +47 -0
- package/protocol_docs/docs/command-groups/network/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/network/ping.md +49 -0
- package/protocol_docs/docs/command-groups/system/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/system/system-state.md +59 -0
- package/protocol_docs/docs/command-groups/track/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/track/tse-prog-read.md +37 -0
- package/protocol_docs/docs/command-groups/track/tse-prog-write.md +35 -0
- package/protocol_docs/docs/command-groups/train/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/train/train-part-find.md +33 -0
- package/protocol_docs/docs/command-groups/vehicles/_category_.json +4 -0
- package/protocol_docs/docs/command-groups/vehicles/vehicle-function.md +36 -0
- package/protocol_docs/docs/command-groups/vehicles/vehicle-mode.md +143 -0
- package/protocol_docs/docs/command-groups/vehicles/vehicle-special-function-switch.md +35 -0
- package/protocol_docs/docs/command-groups/vehicles/vehicle-speed.md +55 -0
- package/protocol_docs/docs/description.md +4 -0
- package/protocol_docs/docs/introduction/_category_.json +4 -0
- package/protocol_docs/docs/introduction/how-it-works.md +61 -0
- package/protocol_docs/docs/introduction/implementation.md +39 -0
- package/protocol_docs/docs/introduction/interface.md +62 -0
- package/protocol_docs/docs/introduction/introduction.md +82 -0
- package/protocol_docs/docusaurus.config.js +111 -0
- package/protocol_docs/package-lock.json +25611 -0
- package/protocol_docs/package.json +47 -0
- package/protocol_docs/sidebars.js +22 -0
- package/protocol_docs/src/components/CommandAndGroup/index.tsx +16 -0
- package/protocol_docs/src/components/CommandAndGroup/styles.module.css +12 -0
- package/protocol_docs/src/components/HomepageFeatures/index.tsx +70 -0
- package/protocol_docs/src/components/HomepageFeatures/styles.module.css +11 -0
- package/protocol_docs/src/css/custom.css +76 -0
- package/protocol_docs/src/pages/index.module.css +23 -0
- package/protocol_docs/src/pages/index.tsx +41 -0
- package/protocol_docs/src/pages/markdown-page.md +7 -0
- package/protocol_docs/static/.nojekyll +0 -0
- package/protocol_docs/static/img/docusaurus.png +0 -0
- package/protocol_docs/static/img/favicon.ico +0 -0
- package/protocol_docs/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/protocol_docs/static/img/undraw_docusaurus_react.svg +170 -0
- package/protocol_docs/static/img/undraw_docusaurus_tree.svg +40 -0
- package/protocol_docs/static/typedoc/index.html +10 -0
- package/protocol_docs/tsconfig.json +7 -0
- package/src/@types/communication.ts +73 -0
- package/src/@types/models.ts +215 -0
- package/src/MX10.ts +351 -0
- package/src/docs_entrypoint.ts +34 -0
- package/src/index.ts +8 -0
- package/src/internal/bites.ts +11 -0
- package/src/internal/speedUtils.ts +36 -0
- package/src/internal/utils.ts +3 -0
- package/src/util/enums.ts +147 -0
- package/src/util/extended-ascii.ts +179 -0
- package/src/zcan/accessoryCommandGroup.ts +24 -0
- package/src/zcan/dataGroup.ts +342 -0
- package/src/zcan/fileControlGroup.ts +25 -0
- package/src/zcan/fileTransferGroup.ts +25 -0
- package/src/zcan/index.ts +37 -0
- package/src/zcan/infoGroup.ts +90 -0
- package/src/zcan/lanDataGroup.ts +361 -0
- package/src/zcan/lanInfoGroup.ts +86 -0
- package/src/zcan/lanNetworkGroup.ts +70 -0
- package/src/zcan/lanZimoProgrammableScriptGroup.ts +25 -0
- package/src/zcan/networkGroup.ts +71 -0
- package/src/zcan/propertyConfigGroup.ts +25 -0
- package/src/zcan/railwayControlGroup.ts +25 -0
- package/src/zcan/systemControlGroup.ts +62 -0
- package/src/zcan/trackCfgGroup.ts +109 -0
- package/src/zcan/trainControlGroup.ts +48 -0
- package/src/zcan/vehicleGroup.ts +267 -0
- package/src/zcan/zimoProgrammableScriptGroup.ts +25 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.json +49 -0
- package/tsconfig.test.json +9 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: vehicle-speed
|
|
3
|
+
title: Vehicle Speed
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import CommandAndGroup from '@site/src/components/CommandAndGroup';
|
|
8
|
+
|
|
9
|
+
<CommandAndGroup group="02" command="02"/>
|
|
10
|
+
|
|
11
|
+
:::info
|
|
12
|
+
|
|
13
|
+
East/West direction can't be changed with this command.
|
|
14
|
+
It can be changed with [Vehicle special function switch](./vehicle-special-function-switch.md)
|
|
15
|
+
|
|
16
|
+
:::
|
|
17
|
+
|
|
18
|
+
## Receiving
|
|
19
|
+
|
|
20
|
+
When receiving command _0x02_ the 'Data' section will look like this:
|
|
21
|
+
|
|
22
|
+
| NID | Speed and direction | Divisor |
|
|
23
|
+
|--------|---------------------|---------|
|
|
24
|
+
| 16 Bit | 16 Bit | 8 Bit |
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
If Mode = 0b00, then the speed of the locomotive is requested with 'NID'. <br/> If M = 0b01, then the speed of the
|
|
28
|
+
locomotive is set to the transferred value with 'NID'. <br/> If M = 0b11, then the locomotive responds with 'NID' to the
|
|
29
|
+
request for its speed. <br/> Speeds are always sent with 10 Bit, in the upper 6 Bit additional Flags are sent. The
|
|
30
|
+
respective conversion into rail format is done in the TSE. The 'Divisor' value indicates a shunting divisor (e.g.: /2 or
|
|
31
|
+
/4) for a finer shunting resolution.
|
|
32
|
+
|
|
33
|
+
### Speed and direction flags
|
|
34
|
+
|
|
35
|
+
| Bit | Description | Value description |
|
|
36
|
+
|-----------|--------------------------------------------------|--------------------------------------------------|
|
|
37
|
+
| 0 ... 9 | Vehicle speed |
|
|
38
|
+
| 10 | Direction instruction (client to MX10) | '0' ➔ Forward <br/> '1' ➔ Backward |
|
|
39
|
+
| 11 | Current track direction (MX10 to client) | '0' ➔ Forward <br/> '1' ➔ Backward |
|
|
40
|
+
| 12 ... 13 | Sideways direction (Last direction from RailCom) | '0' ➔ Undefined <br/> '1' ➔ East<br/> '2' ➔ West |
|
|
41
|
+
| 14 | Unused 🚧 | |
|
|
42
|
+
| 15 | Vehicle Emergency Stop | |
|
|
43
|
+
|
|
44
|
+
:::note
|
|
45
|
+
For all track formats, the maximum ZIMO speed is 1008. Values > 1008 are automatically set to 1008.
|
|
46
|
+
:::
|
|
47
|
+
|
|
48
|
+
## Sending
|
|
49
|
+
|
|
50
|
+
When sending command _0x02_ the 'Data' section will look like this:
|
|
51
|
+
|
|
52
|
+
| Vehicle address | Speed + direction | Value |
|
|
53
|
+
|-----------------|-------------------|-----------------|
|
|
54
|
+
| 16 Bit | 16 Bit | 0x0000 - 16 Bit |
|
|
55
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: how-it-works
|
|
3
|
+
title: How It Works
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## General structure of the message
|
|
8
|
+
|
|
9
|
+
The command groups are structured in such a way that the respective CAN devices can use them as a filter criterion and thus do not have to evaluate all messages on the CAN bus.
|
|
10
|
+
|
|
11
|
+
The use of the data bytes depends on the respective command. As far as reasonable, they are used in the following order:
|
|
12
|
+
|
|
13
|
+
1. Destination ID Used when a specific device is to be addressed (e.g.: A turnout, a feedback device or a locomotive).
|
|
14
|
+
2. Remaining data bytes These are used differently depending on the command; the exact use is listed with the individual commands.
|
|
15
|
+
|
|
16
|
+
<table>
|
|
17
|
+
<thead>
|
|
18
|
+
<tr>
|
|
19
|
+
<th>ID Command Group</th>
|
|
20
|
+
<th>Counter</th>
|
|
21
|
+
<th>Data Byte 1</th>
|
|
22
|
+
<th>Data Byte 2</th>
|
|
23
|
+
<th>Data Byte 3</th>
|
|
24
|
+
<th>Data Byte 4</th>
|
|
25
|
+
<th>Data Byte 5</th>
|
|
26
|
+
<th>Data Byte 6</th>
|
|
27
|
+
<th>Data Byte 7</th>
|
|
28
|
+
<th>Data Byte 8</th>
|
|
29
|
+
</tr>
|
|
30
|
+
</thead>
|
|
31
|
+
<tbody>
|
|
32
|
+
<tr>
|
|
33
|
+
<td>Command Group</td>
|
|
34
|
+
<td></td>
|
|
35
|
+
<td colspan="2">[Target ID]</td>
|
|
36
|
+
<td colspan="6">[More data after command]</td>
|
|
37
|
+
</tr>
|
|
38
|
+
</tbody>
|
|
39
|
+
</table>
|
|
40
|
+
|
|
41
|
+
## Basic ID structure:
|
|
42
|
+
|
|
43
|
+
All 29 ID bits are shown in sequence, the **CAN** internal flags are not shown.
|
|
44
|
+
|
|
45
|
+
| Bit 0 ... 15 | Bit 16 / 17 | Bit 18 ... 23 | Bit 24 ... 27 | Bit 28 |
|
|
46
|
+
|--------------|-------------|---------------|---------------|----------|
|
|
47
|
+
| 16 | 2 | 6 | 4 | 1 |
|
|
48
|
+
| Network ID | Mode | Command | Group | Flag '1' |
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Description of bit fields
|
|
52
|
+
|
|
53
|
+
Field distribution for requests, commands, events and confirmations
|
|
54
|
+
|
|
55
|
+
| Field | Description |
|
|
56
|
+
|-----------|------------------------------------------------------------------------------------------------------------------|
|
|
57
|
+
| Flag | Always '1', serves to distinguish other protocols |
|
|
58
|
+
| Group | 4 bits for the respective command group. Indicates the respective Command Group (Sys, FeedBack, Loco, ...) |
|
|
59
|
+
| Cmd | This 6 bit field contains the respective command |
|
|
60
|
+
| Mode | 0b00: Request information <br/> 0b01: Control commands, Set values, etc. <br/> 0b10: Events <br/> 0b11: Response |
|
|
61
|
+
| NetworkID | Identification number of the 'sender'. Primarily necessary to avoid collisions at the bus. |
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: implementation
|
|
3
|
+
title: Implementation
|
|
4
|
+
sidebar_position: 3
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
1. In principle, all commands are confirmed by 'ACKs', but this confirmation may take some time, depending on the command.
|
|
8
|
+
2. A PC software MUST also process 'ACKs' for commands which it did not send itself. The MX10 always sends 'Command Acknowledgements' to all interfaces (physical CAN bus, XPressNet, PC interface).
|
|
9
|
+
3. The computer software must be able to process the deviation data in "ACK". The computer software is responsible for this and must display the deviation data accordingly.
|
|
10
|
+
4. A PC software must assume that it is not the only command source in the system, i.e: Control panels, possibly other programs or system-internal processes generate commands.
|
|
11
|
+
5. The 'ACKs' always represent the MX10 internal state. This can deviate for various reasons from the desired state of a PC software for various reasons.
|
|
12
|
+
6. The MX10 is designed for maximum data throughput. Commands with up to 1MBaud can be sent from the PC via the USB interface. PC can be sent. This corresponds to about 5000 to 15,000 commands per second (depending on the transmitted data bytes).
|
|
13
|
+
7. All commands (CMDs) are immediately mapped by MX10 into the respective object (vehicle, switch, MX8, MX9, ...).
|
|
14
|
+
8. Each object has its own asynchronously running state engine, which implements the desired target state.
|
|
15
|
+
9. The object state engines process the commands with the respective possible speed. DCC commands need about 20mS until they reach a vehicle decoder for the first time. Commands to MX8 or MX9 modules in average only about 5mS.
|
|
16
|
+
10. This means that MX8/MX9 commands can e.g.: Rail commands (vehicles, switches) can 'overtake'. The PC must therefore assume that it can receive an ACK for commands sent 'later'.
|
|
17
|
+
11. Particular attention must be paid to the following in the case of vehicle commands: _If speed changes and function commands are sent to the same vehicle, the speed commands have priority over the function commands and are therefore processed first and also acknowledged._
|
|
18
|
+
12. If speed commands are sent continuously over the interface, in a faster order than they can be sent to the track, then the 'most current' speed is always sent to the track. Intermediate jumps are ignored and thus skipped.
|
|
19
|
+
13. The computer software must also assume that function commands are sent to the vehicle with a significant delay if the vehicle is simultaneously 'overloaded' with speed commands. In the worst case (because speed commands are present) only every 32nd command is used to send functions (so it may take 640 mS), for a full update of all functions (28) this means about 1.5 seconds!
|
|
20
|
+
14. As noted above, each command is usually acknowledged by 'its' ACK, i.e., in essence, the corresponding command is 1:1 as an ACK with the corresponding 'ACTUAL' data. However, in some cases it is not possible. In the DCC format, functions are transferred to the vehicle in groups. Therefore ACK is also sent as a 'collective' ACK, which contains the status of all 32 functions.
|
|
21
|
+
15. An application must send a message to the MX10 at least every 60 seconds, otherwise the connection is 'terminated' by the MX10. This is a protection for applications, which e.g.: 'crash', or leave the W-LAN range.
|
|
22
|
+
|
|
23
|
+
## Optimal implementation for pc software
|
|
24
|
+
|
|
25
|
+
For a PC software to use the possible interface throughput, it should implement the following:
|
|
26
|
+
|
|
27
|
+
1. All commands sent by you should be stored in a list by the PC software (ring buffer).
|
|
28
|
+
2. Commands which only change data (e.g.: speed) should not be entered in this list, but overwrite the already existing command.
|
|
29
|
+
3. All "ACKs" from MX10 should be deleted from the list as 'done'.
|
|
30
|
+
4. At the same time, it should be checked whether the 'confirmed' data (e.g.: speed) deviates from the own set-point.
|
|
31
|
+
5. in case of deviation the software SHALL react sensibly, e.g. by sending:
|
|
32
|
+
|
|
33
|
+
- Own set-point,
|
|
34
|
+
- User Info,
|
|
35
|
+
- Automatic adjustment of interlocking,
|
|
36
|
+
- Speeds of other vehicles ... etc.
|
|
37
|
+
|
|
38
|
+
6. ACKs which are not present in the list, i.e. which were not sent by the PC software, must be processed sensibly. In particular, 'ALL OFF', 'ALL STOP' must be observed here. But of course also travel commands and switching commands to vehicles.
|
|
39
|
+
7. Depending on the type of command, PC software may assume that the ACK's require 500mS to 2000mS. Especially Rail commands can have considerable delays. If the PC software does NOT receive an ACK within this worst-case period, it must assume that an error has occurred.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: interface
|
|
3
|
+
title: Interface
|
|
4
|
+
sidebar_position: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## PC interface
|
|
8
|
+
|
|
9
|
+
The connection to the PC can be made via Virtual (USB) Com-Port or Ethernet. In both cases the (CAN) protocol described here is used. Please note:
|
|
10
|
+
|
|
11
|
+
1. Each command has a data length specification, this must be adhered to. The length ALWAYS refers to the user data, not to the header/tail or the command identification. (Size, Group, Cmd, Mode, ...).
|
|
12
|
+
2. With a few exceptions, the protocol corresponds to the internally used CAN protocol. Therefore max. 8 data bytes are used.
|
|
13
|
+
3. To optimize the communication with the PC, there are some commands (Group 0x10 ... 0x1F), which can transfer up to 256 data bytes.
|
|
14
|
+
|
|
15
|
+
## PC USB interface
|
|
16
|
+
|
|
17
|
+
The CAN data-grams are transferred between the ZIMO system USB interface and the PC using the following method
|
|
18
|
+
|
|
19
|
+
### Establishing / initializing the connection
|
|
20
|
+
|
|
21
|
+
If the PC wants to establish a connection, it must initialize the establishment by sending the string 'Z22Z' (=0x5A, 0x32, 0x32, 0x5A) to initialize the connection. Only after the MX10 has 'understood' such a string, it responds with a 'ping' telegram. a 'ping' telegram. If the ping fails for more than 500mS, the setup ring must be repeated. If there is no ping even after the third attempt, an error must be assumed.
|
|
22
|
+
|
|
23
|
+
### Structure of the data telegrams for the zimo 2.x format for virtual com
|
|
24
|
+
|
|
25
|
+
For the new CAN protocol the characters 'Z2' / '2Z' are used as telegram delimiter. In this case the CAN ID is transmitted field by field (Group, Direction, Command and NID).
|
|
26
|
+
|
|
27
|
+
| Header | Size (DLC) | Group | Cmd + Mode | NID | Data 0 ... 8 | CRC16 | Tail |
|
|
28
|
+
|--------|------------|-------|------------|--------|--------------|--------|--------|
|
|
29
|
+
| 16 Bit | 8 Bit | 8 Bit | 8 Bit | 16 Bit | 8 x 8 Bit | 16 Bit | 16 Bit |
|
|
30
|
+
| 0x5A32 | | | | | | | 0x325A |
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
CAN data-grams are essentially sent 1:1 within the frame defined above. However, since the USB (VCom) connection does not have a fixed limit of 8 data bytes, larger data-grams can be sent or received.
|
|
34
|
+
|
|
35
|
+
:::note
|
|
36
|
+
|
|
37
|
+
CRC16: When using a USB (Virtual COM Port) interface the value 0x0000 (CRC Ignore) can be used as CRC16. because the USB hardware already takes care for an error free transmission.
|
|
38
|
+
|
|
39
|
+
:::
|
|
40
|
+
|
|
41
|
+
## Ethernet/udp interface
|
|
42
|
+
|
|
43
|
+
The Ethernet interface uses basically the same method for data transfer. The app layer data transfer is done in the Ethernet (LAN/W-LAN) via IP/UDP frames. A PC software (or App) sends its requests/commands via the UDP port 14520 to the MX10, the answers of the MX10 arrive at the PC, Tab, ... at port 14521.
|
|
44
|
+
|
|
45
|
+
To initiate the connection the application must send a port 'Open' ([0x0A.0x06 or 0x1A.0x06]) to the MX10.
|
|
46
|
+
|
|
47
|
+
:::note
|
|
48
|
+
|
|
49
|
+
The ports can also be set to other values on the MX10, please refer to MX10 manual.
|
|
50
|
+
|
|
51
|
+
:::
|
|
52
|
+
|
|
53
|
+
### Structure of the data telegrams for the zimo 2.x format via udp
|
|
54
|
+
|
|
55
|
+
For the data-gram transmission in the Ethernet no delimiters are necessary ('Z2' ... '2Z') because this is covered by the Ethernet frame logic. As with the USB (VCom) interface, the data is transferred 1:1 in the Ethernet as on the CAN bus. But there are some additional Ethernet data-grams, which can transfer much more data to the system. MX10 can send more data in one data-gram to the PC. These LAN special commands are listed separately.
|
|
56
|
+
|
|
57
|
+
| Size (DLC) | Unused | Group | Cmd + Mode | NID | Data 0 ... x |
|
|
58
|
+
|------------|--------|-------|------------|--------|--------------|
|
|
59
|
+
| 16 Bit | 16 Bit | 8 Bit | 8 Bit | 16 Bit | |
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Since an Ethernet frame typically comprises 1536 bytes, the length specification has increased to 16 bits compared to the VCom interface. bit compared to the VCom interface. Additionally, there is a currently unused 16 bit field. This is intended for later extensions.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: introduction
|
|
3
|
+
title: Overview
|
|
4
|
+
sidebar_position: 0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Protocol
|
|
8
|
+
|
|
9
|
+
The currently used ZIMO CAN protocol is now quite old (> 10 years) and has grown historically. It is therefore hardly possible to adapt this protocol to new requirements. For this reason, the devices of the Zs series (2010) will use a new extended protocol in parallel to the current CAN protocol (ZCAN10).
|
|
10
|
+
|
|
11
|
+
The MX10 supports both protocols on its two CAN sockets. The CAN sockets labeled ZIMO use the 'old' protocol by default, while the sockets from other devices use the new CAN protocol. However, this can be changed in the MX10 menu at any time as required.
|
|
12
|
+
|
|
13
|
+
## Layer 7
|
|
14
|
+
|
|
15
|
+
So that a model railroad can actually be controlled, a layer-7 (application) must also be defined. The Layer-7 definition contains the definition of the 29Bit ID's and the 8 data bytes. So that such a CAN protocol works properly, it must be ensured that the 29Bit ID's of the CAN bus are unique system-wide.
|
|
16
|
+
|
|
17
|
+
Practically all CAN controllers can mask and/or filter the CAN ID. By a CAN ID's it is possible to filter all CAN messages in such a way, that the respective device only has to process those messages which are really relevant. A turnout decoder for example does not get 'locomotive commands' at all. Conversely, a booster does not need to worry about 'switching commands'.
|
|
18
|
+
|
|
19
|
+
## Addressing
|
|
20
|
+
|
|
21
|
+
In the following, the term "object" is often used. By this term you can imagine any "addressable" thing on a model railway. In particular, it does not matter whether it is a vehicle, a switch or a USB key. All that matters is that such an object has a unique address (UID) in the active system and a few basic properties.
|
|
22
|
+
|
|
23
|
+
Of course, specific objects have, in addition to their basic properties, "custom" properties that are valid only for this one object. For historical reasons, a distinction has to be made between "legacy objects" and ZCAN20 objects. Legacy Objects (DCC locomotive / turnout decoder, ...) do not have their own UIDs and their properties are mostly distributed in different CVs, or partially not available. ZCAN20 objects (but also ESU/Märklin) have a unique UID and also the necessary basic properties. In order to be able to use also common decoders and devices, there must be a management system that simulates the ZCAN20 objects to the rest of the system by means of computation, stored configurations, etc. In this way, even "legacy/conventional" decoders and other devices behave as ZCAN20 objects.
|
|
24
|
+
|
|
25
|
+
## Translate Table For Legacy Devices:
|
|
26
|
+
|
|
27
|
+
| UID Word1 | UID Word2 Min. | UID Word2 Max | Available Addresses | |
|
|
28
|
+
|-----------|----------------|---------------|---------------------|----------------------------------|
|
|
29
|
+
| 0x0000 | 0x0000 | 0x27FF | 10240 | DCC Locomotives |
|
|
30
|
+
| 0x0000 | 0x2800 | 0x28FF | 256 | MM1/MM2 Locomotives |
|
|
31
|
+
| 0x0000 | 0x2900 | 0x2EFF | 3072 | Available [1] |
|
|
32
|
+
| 0x0000 | 0x2F00 | 0x2FFF | 256 | Multi-tractions |
|
|
33
|
+
| 0x0000 | 0x3000 | 0x31FF | 512 | DCC 'Basic' Accessory Decoder |
|
|
34
|
+
| 0x0000 | 0x3200 | 0x39FF | 2058 | DCC 'Extended' Accessory Decoder |
|
|
35
|
+
| 0x0000 | 0x3A00 | 0x3DFF | 1024 | MM1 Accessory Decoder |
|
|
36
|
+
| 0x0000 | 0x4000 | 0x43FF | 1024 | S88 Feedback |
|
|
37
|
+
| 0x0000 | 0x4400 | 0x45FF | 1024 | X-Net Decoder |
|
|
38
|
+
| 0x0000 | 0x4600 | 0x47FF | 1024 | X-Net Feedback |
|
|
39
|
+
| 0x0000 | 0x4800 | 0x4FFF | 2048 | Available [2] |
|
|
40
|
+
|
|
41
|
+
### ZIMO Device Generation 1
|
|
42
|
+
| UID Word1 | UID Word2 Min. | UID Word2 Max | Available Addresses | |
|
|
43
|
+
|-----------|----------------|---------------|---------------------|------------------------------------------|
|
|
44
|
+
| 0x0000 | 0x5000 | 0x503F | 64 | MX1 |
|
|
45
|
+
| 0x0000 | 0x5040 | 0x507F | 64 | MX8 Module, Channel 1 |
|
|
46
|
+
| 0x0000 | 0x5080 | 0x50BF | 64 | MX9 Module, Channel 1 |
|
|
47
|
+
| 0x0000 | 0x50C0 | 0x50CF | 16 | CSA Module |
|
|
48
|
+
| 0x0000 | 0x50D0 | 0x50DF | 16 | MX31 |
|
|
49
|
+
| 0x0000 | 0x5100 | 0x513F | 64 | MX8 Module, Channel 2 |
|
|
50
|
+
| 0x0000 | 0x5140 | 0x517F | 64 | MX9 Module, Channel 2 |
|
|
51
|
+
| 0x0000 | 0x5800 | 0x5800 | 128 | I2C eXtender, Differentiation see SubCmd |
|
|
52
|
+
| 0x0000 | 0x5A00 | 0x5AFF | 256 | Block locations |
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### ZIMO System Database
|
|
56
|
+
|
|
57
|
+
| UID Word2 Min. | UID Word2 Max | Available Addresses | |
|
|
58
|
+
|----------------|-------------------------------------|---------------------|----------------|
|
|
59
|
+
| 0x6000 | 0x60FF Panels / GBS / Signal boxes |
|
|
60
|
+
| 0x6100 | 0x63FF | 768 | Routes |
|
|
61
|
+
| 0x6400 | 0x65FF | | |
|
|
62
|
+
| 0x6600 | 0x66FF | 256 | Sound Projects |
|
|
63
|
+
| 0x6700 | 0x7FFF | | Reserved |
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Mfx Addresses
|
|
67
|
+
|
|
68
|
+
| UID Word1 | UID Word2 Min. | UID Word2 Max | Available Addresses | |
|
|
69
|
+
|-----------|----------------|---------------|---------------------|-----------------|
|
|
70
|
+
| 0x0000 | 0x8000 | 0xBFFF | 16384 | Mfx Locomotives |
|
|
71
|
+
|
|
72
|
+
### ZIMO CAN 2.xx devices (Also from non ZIMO manufacturers)
|
|
73
|
+
| UID Word2 Min. | UID Word2 Max | Available Addresses | |
|
|
74
|
+
|----------------|---------------|---------------------|------------------------------|
|
|
75
|
+
| 0xC000 | 0xC0FF | 256 | MX10 Central |
|
|
76
|
+
| 0xC100 | 0xC1FF | 256 | MX10 Booster |
|
|
77
|
+
| 0xC200 | 0xC2FF | 256 | Special equipment (IF, ....) |
|
|
78
|
+
| 0xC300 | 0xC3FF | 256 | Driving consoles |
|
|
79
|
+
| 0xC400 | 0xC4FF | 256 | MX32 Radio modules |
|
|
80
|
+
| 0xD000 | 0xDFFF | 4096 | Module |
|
|
81
|
+
| 0xE000 | 0xEFFF | 4096 | Object |
|
|
82
|
+
| 0xF000 | 0xFFFF | 4096 | Files |
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// Note: type annotations allow type checking and IDEs autocompletion
|
|
3
|
+
|
|
4
|
+
const lightCodeTheme = require('prism-react-renderer/themes/github');
|
|
5
|
+
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
|
|
6
|
+
|
|
7
|
+
/** @type {import('@docusaurus/types').Config} */
|
|
8
|
+
const config = {
|
|
9
|
+
title: 'ZCAN',
|
|
10
|
+
tagline: 'ZIMO CAN Bus Documentation',
|
|
11
|
+
url: 'https://your-docusaurus-test-site.com',
|
|
12
|
+
baseUrl: '/zcan',
|
|
13
|
+
onBrokenLinks: 'throw',
|
|
14
|
+
onBrokenMarkdownLinks: 'warn',
|
|
15
|
+
favicon: 'img/favicon.ico',
|
|
16
|
+
|
|
17
|
+
// GitHub pages deployment config.
|
|
18
|
+
// If you aren't using GitHub pages, you don't need these.
|
|
19
|
+
organizationName: 'Consultis', // Usually your GitHub org/user name.
|
|
20
|
+
projectName: 'zcan', // Usually your repo name.
|
|
21
|
+
|
|
22
|
+
// Even if you don't use internalization, you can use this field to set useful
|
|
23
|
+
// metadata like html lang. For example, if your site is Chinese, you may want
|
|
24
|
+
// to replace "en" with "zh-Hans".
|
|
25
|
+
i18n: {
|
|
26
|
+
defaultLocale: 'en',
|
|
27
|
+
locales: ['en'],
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
presets: [
|
|
31
|
+
[
|
|
32
|
+
'classic',
|
|
33
|
+
/** @type {import('@docusaurus/preset-classic').Options} */
|
|
34
|
+
({
|
|
35
|
+
docs: {
|
|
36
|
+
sidebarPath: require.resolve('./sidebars.js'),
|
|
37
|
+
// Please change this to your repo.
|
|
38
|
+
// Remove this to remove the "edit this page" links.
|
|
39
|
+
editUrl: 'https://git.consultis.sk/Consultis/zcan',
|
|
40
|
+
},
|
|
41
|
+
blog: false,
|
|
42
|
+
|
|
43
|
+
theme: {
|
|
44
|
+
customCss: require.resolve('./src/css/custom.css'),
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
],
|
|
48
|
+
],
|
|
49
|
+
|
|
50
|
+
themes: [
|
|
51
|
+
// ... Your other themes.
|
|
52
|
+
[
|
|
53
|
+
require.resolve('@easyops-cn/docusaurus-search-local'),
|
|
54
|
+
{
|
|
55
|
+
// ... Your options.
|
|
56
|
+
// `hashed` is recommended as long-term-cache of index file is possible.
|
|
57
|
+
hashed: true,
|
|
58
|
+
language: ['en'],
|
|
59
|
+
highlightSearchTermsOnTargetPage: true,
|
|
60
|
+
explicitSearchResultPath: true,
|
|
61
|
+
// For Docs using Chinese, The `language` is recommended to set to:
|
|
62
|
+
// ```
|
|
63
|
+
// language: ["en", "zh"],
|
|
64
|
+
// ```
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
],
|
|
68
|
+
|
|
69
|
+
themeConfig:
|
|
70
|
+
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
|
71
|
+
({
|
|
72
|
+
navbar: {
|
|
73
|
+
title: 'ZCan',
|
|
74
|
+
// logo: {
|
|
75
|
+
// alt: 'My Site Logo',
|
|
76
|
+
// src: 'img/logo.svg',
|
|
77
|
+
// },
|
|
78
|
+
items: [
|
|
79
|
+
{
|
|
80
|
+
href: 'typedoc/index.html',
|
|
81
|
+
position: 'right',
|
|
82
|
+
label: 'API',
|
|
83
|
+
target: '_blank',
|
|
84
|
+
prependBaseUrlToHref: true,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
type: 'doc',
|
|
88
|
+
docId: 'introduction/introduction',
|
|
89
|
+
position: 'right',
|
|
90
|
+
label: 'Protocol',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
href: 'https://github.com/ZIMO-Elektronik/zcan',
|
|
94
|
+
label: 'GitHub',
|
|
95
|
+
position: 'right',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
footer: {
|
|
100
|
+
style: 'dark',
|
|
101
|
+
|
|
102
|
+
copyright: `Copyright © ${new Date().getFullYear()} ZCAN, Consultis k.s.`,
|
|
103
|
+
},
|
|
104
|
+
prism: {
|
|
105
|
+
theme: lightCodeTheme,
|
|
106
|
+
darkTheme: darkCodeTheme,
|
|
107
|
+
},
|
|
108
|
+
}),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
module.exports = config;
|