A simple CAN application example.
I tested using Espressif ESP32 DevKitC: https://docs.zephyrproject.org/latest/boards/espressif/esp32_devkitc/doc/index.html
- clone this repository wherever you like.
- chdir to the cloned repository
$ cd zephyr-canapp
- Setup build environment.
$ source ~/zephyrproject/zephyr/zephyr-env.sh
- Build
west build -p -b esp32_devkitc/esp32/procpu .
- Flash
west flash
- Run
west espressif monitor
- Use CAN shell
uart:~$ can help
Qemu supports CAN Bus emulation. See https://www.qemu.org/docs/master/system/devices/can.html for the details.
From my experiences, CONFIG_CAN_KVASER_PCI does not work for Zephyr qemu_kvm_arm64 board. Use qemu_x86_64 (for now).
Edit prj.conf (comment out CONFIG_CAN_ESP32_TWAI and enable CONFIG_CAN_KVASER_PCI), and build it.
$ west build -p -b qemu_x86_64 .
- Port simple_can_simulator.py bundled in AGL, Automotive Grade Linux
- Consider integration of http_server feature and exposing status/diagnostics information
- Explore UDS support in Zephyr (as a seperate project) and add UDS responder feature
- Explore integration of virtio_net and virtio_can (under development)
Apache 2.0