Pure MoonBit building blocks for CAN 2.0 and CAN-FD protocol work: validated frames, deterministic wire codecs, filters, arbitration, a virtual bus, and JSON/CSV event logs.
Status
The first release focuses on protocol modeling and hardware-free simulation. It does not provide SocketCAN, USB, or native hardware access. DBC, UDS, J1939, and CANopen are planned extension areas.
Build and test
moon fmt --check
moon info --target all
moon check --deny-warn --fmt --target all
moon test --deny-warn --target all
moon run cmd/can-demo
The installed MoonBit CLI currently exposes warning denial on moon check,
not on moon fmt or moon info; the CI uses the supported equivalent checks
and fails on any formatting diff.
Packages
frame: standard/extended identifiers, data/remote/error frames, classic and FD payload validation.
codec: DLC mapping, bitstreams, CRC, bit stuffing, and strict frame encoding/decoding.
filter: identifier, mask, frame-kind, and payload acceptance rules.
The example creates controller and logger nodes, arbitrates one standard
frame, delivers it through an exact-ID filter, and prints a replayable JSON
trace.
Design boundary
The core is dependency-light and written in MoonBit. It models protocol semantics and repeatable test scenarios; it does not claim to replace certified automotive stacks, hardware drivers, or real-time controller firmware.
Ecosystem review
On 2026-08-06, Mooncakes searches for can, canbus, socketcan, can-fd, dbc, uds, j1939, and canopen found no mature package with this same protocol-and-simulation scope. The broad can search primarily matched unrelated canvas packages. See docs/ecosystem.md for the bounded review and sources.
moonbit-canbus
Pure MoonBit building blocks for CAN 2.0 and CAN-FD protocol work: validated frames, deterministic wire codecs, filters, arbitration, a virtual bus, and JSON/CSV event logs.
Status
The first release focuses on protocol modeling and hardware-free simulation. It does not provide SocketCAN, USB, or native hardware access. DBC, UDS, J1939, and CANopen are planned extension areas.
Build and test
The installed MoonBit CLI currently exposes warning denial on
moon check, not onmoon fmtormoon info; the CI uses the supported equivalent checks and fails on any formatting diff.Packages
frame: standard/extended identifiers, data/remote/error frames, classic and FD payload validation.codec: DLC mapping, bitstreams, CRC, bit stuffing, and strict frame encoding/decoding.filter: identifier, mask, frame-kind, and payload acceptance rules.sim: bounded queues, deterministic arbitration, logical timestamps, nodes, and virtual-bus events.log: versioned JSON and CSV interchange for simulation traces.trace: deterministic event selection, frame extraction, summary counters, and log round trips.Quick example
The example creates controller and logger nodes, arbitrates one standard frame, delivers it through an exact-ID filter, and prints a replayable JSON trace.
Design boundary
The core is dependency-light and written in MoonBit. It models protocol semantics and repeatable test scenarios; it does not claim to replace certified automotive stacks, hardware drivers, or real-time controller firmware.
Ecosystem review
On 2026-08-06, Mooncakes searches for
can,canbus,socketcan,can-fd,dbc,uds,j1939, andcanopenfound no mature package with this same protocol-and-simulation scope. The broadcansearch primarily matched unrelated canvas packages. Seedocs/ecosystem.mdfor the bounded review and sources.License
Apache-2.0. See LICENSE.