CAN to Ethernet bridge
======================

.. appnote:: AN00114

.. version:: 1.0.0

Summary
-------

Since XMOS multicore microcontrollers implement communications protocols purely in software, very flexible bridging systems can be built that meet your exact requirements.

This application note shows how to create a single port CAN protocol to an Ethernet bridge.  An application bridge function is created to demonstrate how CAN frames from the CAN network are converted into Ethernet (TCP packets) and vice versa. The Ethernet data from the XMOS device can be sent to a TCP client application running on the host which displays them as CAN frames on the console. This host application can also be used to send data to the XMOS device which in turn is sent to the CAN network.

This code could easily be extended to build multi-port CAN to Ethernet bridge and switch solutions.  Furthermore, the principles demonstrated in this application note can be used to build bridges and switches for any of the array of communications protocols supported in xSOFTip libraries.

Required tools and libraries
............................

* xTIMEcomposer Tools - Version 13.1.0
* XMOS Ethernet/TCP xSOFTip component - Version 3.2.1rc1
* XMOS CAN bus xSOFTip component - Version 2.0.0rc0

Required hardware
.................

This application note is designed to run on an XMOS xCORE General Purpose (L-series) device.

The example code provided with the application has been implemented and tested
on the xCORE L-series sliceKIT core board 1V2 (XP-SKC-L2) but there is no dependency on 
this board and it can be modified to run on any development board which uses an
xCORE General Purpose (L-series), xCORE-USB series or xCORE-Analog series device.

Prerequisites
.............

  - This document assumes familiarity with the XMOS xCORE architecture, the Controller Area Network (CAN) bus specification (and related specifications), the XMOS tool chain and the xC language. Documentation that is not specific to this application note is listed in the references appendix.

  - For descriptions of XMOS related terms found in this document please see the XMOS Glossary [#]_.

  - For information on using XMOS TCP/IP (XTCP) stack please see the `Ethernet TCP/IP component programming guide` [#]_.

  - For information on using XMOS CAN controller please see the `CAN Bus Controller Component` documentation [#]_.

.. [#] http://www.xmos.com/published/glossary

.. [#] http://www.xmos.com/published/ethernet-tcpip-component-programming-guide

.. [#] http://www.xmos.com/published/can-bus-component-%28documentation%29

.. [#] http://www.xmos.com/published/can-bus-component-%28documentation%29

