Skip to content

Latest commit

 

History

History
 
 

zephyr

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Open1722 for Zephyr Applications

Open1722 libraries being written in C can be compiled easily into Zephyr applications. An example here is the acf-can-bridge.. A brief explanation of how to create Zephyr applications including Open1722 is as follows:

Installation of the Zephyr Toolchain

Install the Zephyr SDK and toolchain as mentioned in their Getting Started Guide.

The acf-can-bridge application is made as a freestanding application, i.e., it is located outside the Zephyr workspace. For more information on such applications, refer Zephyr build system.

Building acf-can-bridge for Zephyr

To build freestanding Zephyr applications, refer the blog article.

For this, we will source the Zephyr dependencies in the terminal:

$ source ~/zephyrproject/.venv/bin/activate
$ source ~/zephyrproject/zephyr/zephyr-env.sh

Subsequently, you can build the application using west. We have integrated the build dependencies of the acf-can-bridge application into the main CMake of the project. Hence build commands are executed from the main folder of the repository.

$ west build --pristine -b <board_name> . -- -DCONF_FILE=./examples/acf-can/zephyr/prj.conf -DOPEN1722_ZEPHYR_APP=acf-can-bridge
$ west build -t run # OR west build -t flash

The parameters of the application (e.g. use UDP or the TSCF format) can be set from the prj.conf.

In theory, this should work with any supported Zephyr boards having a CAN and an Ethernet interface. You may need to adjust the name of the interface in the corresponding device tree or code. We have tested the application with following Zephyr boards.

  • native_sim
  • arduino_portenta_h7

Testing on native_sim

To test on native sim, we first create an Ethernet interface and a CAN inzterface for the sim.

For creation of an Ethernet interface, have a look at the net-tools repository from zephyrproject. Clone this repository and execute the net-setup script in another terminal.

$ ./net-setup.sh

This creates the zeth Ethernet interface. You must also create a virtual CAN interface based on the devicetree (zcan) of the native_sim.

With a virtual Ethernet and CAN interface, the application can be executed on native_sim as follows:

$ west build -t run # OR west build -t flash

For testing, one can use can-utils to generate traffic on zcan and observe the Ethernet packets on zeth and vice-versa.