Skip to content

Ethernet CAN Gateway

WIZnet Ethernet HAT Contest Winner Project

WIZnet

Published February 17, 2023

Original author: chcbaramOriginal source (new tab)

Ethernet CAN Gateway

Components

Hardware components

x 1


x 1

Software Apps and online services

x 1


x 1


Project description

Overview

There are many tools for controlling CAN devices. Among them, there is one of the open-source projects called Qt-based CANDevStudio.

CANDev Studio uses a common plug-in called Qt CAN plug-in, which can be used on a Qt basis. However, there was no plug-in here between CAN and Ethernet heterogeneous protocols except Virtual. So, we wanted to create a plug-in that can be used on the Qt base and a gateway that can control CAN devices via Etherent through that plug-in, and that's the project.

Component Diagram

What should be done in the project was clear, as explained in Overview. Therefore, we decided to draw a component diagram to clarify what needs to be done, and to figure out if there is any problem with the composition first.

  • Qt App: Qt-based application with GUI to control CAN devices easily.
  • QtWiznetCanBus: A plug-in which use in Qt-based applications.
  • W5100S: The main character of this project. For Ethernet.
  • Gateway: Firmware running on WIZnet W5100S-Pico-EVB board to handle Ethernet packets, CAN packets and etc.
  • User Interface: Hardware interfaces to use firmware on the board easily.
Ethernet CAN Gateway, Component Diagram

Hardware

We determined the necessary hardware configuration from the diagram above, and designed and built a PCB/case for a more compact design and configuration.

PCB 3D model

PCB 3D model

Case 3D model

Case 3D model

Software

The software was used as a combination of WIZnet ioLibrary + pico + CMake to minimize platform dependence.

Cores

Since the PICO has dual core, roles of these cores are separated as shown below for smooth packet processing.

Shared Memory

We implemented queue buffers in shared memory between two cores to allow each manager (CAN, Ethernet) to operate non-blocking.

Event-Based Socket

In the case of Ethernet Socket, it was created based on Event, making it possible to operate differently depending on the OnWritable() and OnReadable() implementations.

However, due to the nature of the project's configuration, it is made to create only a single socket, so if you want to create multiple sockets, you need to modify the object more extensively.

QtCanBus Plug-in (Only UDP)

We referred to the Cannelloni Can Bus plug-in project, which used the Cannelloni protocol, and created a more general plug-in that could be used without Cannelloni.

QtCanBus Plug-in (Only UDP)

Results

Ethernet CAN Gateway, Results
Ethernet CAN Gateway, Results

Comments

Comments