Dual-CAN Vehicle Speed Signal Gateway
This example uses native BMCLI configuration to adapt speed between two CAN networks: read km/h on chassis, encode m/s on sensor, and apply validity and target protection rules.
sensor-speed.bmgw is a native project with logical chassis and sensor networks. Configure actual devices, bitrates, and wiring in local Bench. Both DBCs describe wire layouts; the project already includes their encoding definitions.
| Item | Configuration |
|---|---|
| Input | chassis, standard CAN 0x100, eight bytes; Speed at bit 0, 16-bit Intel, 0.01 km/h |
| Transformation | m/s = km/h ÷ 3.6 |
| Output | sensor, standard CAN 0x200, eight bytes; Speed at bit 0, 16-bit Intel, 0.01 m/s |
| Validity | Source expires after 100 ms; invalid Speed raw is 65535; target Valid at bit 16 |
| Transmission | Independent target period of 20 ms |
| Teaching protection | Eight-bit Counter at bit 24, CRC8 at byte 7; parameters in project e2e configuration |
Protection demonstrates independent target Counter/CRC generation. DBC defines field positions and project e2e defines the teaching algorithm. Configure production algorithms/plugins from formal specifications and verify with independent vectors.
Offline Check
Section titled “Offline Check”Run in this directory:
bmcli gateway validate --file=sensor-speed.bmgw --format=jsonThis checks gateway project structure and definitions offline.
Bench Exercise
Section titled “Bench Exercise”Prepare two independent test CAN networks: one generates 0x100 and the other receives 0x200. Physical source and receiver acknowledge normally; set bitrates and termination from Bench.
- Use the source DBC to generate 0, 36, 72, and 108 km/h. Expected target values are 0, 10, 20, and 30 m/s.
- Observe target period, Counter, and CRC, then interrupt the source for over 100 ms; the target should emit the agreed invalid encoding and clear validity.
- Restore input and verify validity recovery, retaining raw frames for independent encoding/protection checks.
Connect the real sensor after normal values, timeout, recovery, and target reception meet expectations. On Raspberry Pi, use architecture-matched BMCLI/BMAPI packages and ARM builds of any native plugins.
See tutorial 12.
Download companion examples (ZIP) · Return to the series contents