Ethernet-CAN-Gateway Application

How versatile and customizable emtrion's modules and baseboards are is also demonstrated by the successful attempt to use the SBC SAMA5D36 and the emSTAMP Helium as an Ethernet-CAN-Gateway.

The powerful emtrion boards can be utilized to provide the ever-useful application of working as an Ethernet-CAN-Gateway device. With the emtrion SBC-SAMAD536emSTAMP-Helium boards an application has been developed to serve this purpose.
The user can monitor on a Linux based PC the CAN messages connected to the board via TCP/IP. Messages can also be sent to multiple CAN devices in order to control them, and their responses are displayed on the console.

emtrion's SBC-SAMA5D36
emtrion's SBC-SAMA5D36 with Microchip ATSAMA5D36

The CAN data frames are read by the gateway in chunks and stored in a buffer for encapsulation. The message frames are converted to a structure corresponding to TCP/IP data stream before finally getting pushed to the user. On the opposite direction of the data transfer, the data from the user gets stripped off the TCP overheads and only useful data is stored in the buffer, to be subsequently converted into CAN data frames. Cyclic buffers are implemented in a way ensuring minimum data loss.
The received messages give information about the device ID, data length, the actual payload as well as the various error states of the CAN device under investigation. This makes debugging comfortable for multiple devices connected to a CAN network. Message filters can also be added to this application as an extension if required.
Users have the flexibility to select the CAN interface as well as the Ethernet address, the Baud rate as well as the reset time in case of a Bus-off error in the CAN bus. The console output is equipped to show continuous cyclic data or store it in a data log file. For a CANOpen device, a particular PDO mapping can be stored and sent to the device for continuous data receipt.

emtrion's emSTAMP-Helium
emtrion's emSTAMP-Helium with Microchip ATSAMA5D27

High performance of the application is expected because of the powerful Atmel processors and a well thought-out software architecture with multithreading and block data reading. The final tests indicate that in spite of the conversion steps implemented in between, at a data speed of up to 1Mbps and high data load of 75%, the application drops a few packets only. If compared to the freely available "candump" application (in can-utiles package), the performance of the developed application is miles ahead. This application certainly makes a strong case of highlighting the versatility and strong characteristics of the emtrion boards