GithubHelp home page GithubHelp logo

can's Introduction

can

CAN binding for Erlang

CAN or Controller Area Network for short, is a two wire serial protcol for industrial applications.

This implementation currently supports three different backends:

  • can_usb: CANUSB is a USB dongle from LAWICEL AB.
  • can_udp: This is my own invention. A simple repackaging of CAN frames into UDP/IP datagrams sent over local multicast channel.
  • can_sock: A binding to linux SocketCAN interface.

Any number of backend interfaces may be started and attached to the can_router, which is the main interface to receice and send CAN frames.
An application will typically call can_router:attach() and then receive CAN frames from any of the interfaces. To send a frame then simple call can:send/n, this will pass the CAN frame to all the interfaces and connected local applications in the Erlang node.

Dependencies

To build can you will need a working installation of Erlang R15B (or later).
Information on building and installing Erlang/OTP can be found here (more info).

can is built using rebar that can be found here, with building instructions here.

can also requires the following applications to be installed:

Downloading

Clone the repository in a suitable location:

$ git clone git://github.com/tonyrog/can.git

Configurating

Concepts

Linux virtual can driver

load the driver

$ sudo modprobe vcan

Create a virtual CAN network interface called 'vcan0'

$ sudo ip link add dev vcan0 type vcan

Set the bitrate of the CAN network interface

This must be done prior to bringing the interface up.

$ sudo ip link set vcan0 type can bitrate 125000

Activate a virtual CAN network interface called 'vcan0'

$ sudo ifconfig vcan0 up

Remote a (virtual) CAN network interface 'vcan0'

$ sudp ip link del vcan0

Create a virtual CAN network interface

$ sudo ip link add type vcan

triple-sampling on

Files

...

Building

Rebar will compile all needed dependencies.
Compile:

$ cd can
$ rebar compile
...
==> can (compile)

Running

$ erl -pa <path>/can/ebin
>can_router:start().

(Instead of specifying the path to the ebin directory you can set the environment variable ERL_LIBS.)

Stop:

>halt().

can's People

Contributors

tonyrog avatar malotte avatar uwiger avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.