emcyphal

Emcyphal

Emcyphal implements Cyphal/CAN, a real-time protocol for intra-vehicular distributed computing and communication. The library provides CAN peripheral drivers, (de)segmentation, (de)serialization, and a socket-like async API. It operates in no-std environments using only static memory allocation. Emcyphal is designed for systems with tight interrupt latency requirements, keeping all critical section durations bounded.

Emcyphal primarily targets the Embassy async framework, though tokio/SocketCAN extensions may be possible in the future.

Autogenerated types

One advantage of the Cyphal protocol over raw CAN frames is automatic data type generation from the Data Structure Description Language (DSDL). The library uses a modified code generator derived from the canadensis project.

Generated types for Cyphal public regulated data types are maintained in a separate repository. See the generator documentation for information on combining data types from different sources.

User-facing crates

Getting started

Check the nucleo-g431rb example project to get started. You can run it immediately if you have the board. Otherwise, adapt it to your hardware by adjusting the chip name and output pins.

Alternatives

The library’s use cases overlap with the canadensis project. Here is a brief comparison:

Property Canadensis (v0.5.0) Emcyphal
Execution environment Generic Async executor
Supported transports CAN, Serial, Ethernet CAN
CAN driver for STM32 Classic only (bxcan) Classic, FD (up to 8 Mbps)
CAN driver for Linux SocketCAN None
Dynamic memory Required Not required
API type Non-blocking sync Non-blocking sync, blocking async
Client composition Single entry point, chain of handlers Socket-like API with independent clients
Cyphal roles Publisher, Subscriber, Server, Client Publisher, Subscriber, Server
Built-in services Heartbeat, GetInfo, Port list, PnP, Registers Heartbeat

License

Emcyphal is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.