hubertf's NetBSD Blog
Send interesting links to hubert at feyrer dot de!
 
[20170521] Support for Controller Area Networks (CAN) in NetBSD
Manuel Bouyer has worked on NetBSD CAN-support, and now he writes: ``I'd like to merge the bouyer-socketcan branch to HEAD in the next few days (hopefully early next week, or maybe sunday), unless someone objects to the idea of a socketcan implementation in NetBSD.

CAN stands for Controller Area Network, a broadcast network used in automation and automotive fields. For example, the NMEA2000 standard developped for marine devices uses a CAN network as the link layer.

This is an implementation of the linux socketcan API: https://www.kernel.org/doc/Documentation/networking/can.txt you can also see can(4) in the branch.

This adds a new socket family (AF_CAN) and protocol (PF_CAN), as well as the canconfig(8) utility, used to set timing parameter of CAN hardware. The branch also includes a driver for the CAN controller found in the allwinner A20 SoC (I tested it with an Olimex lime2 board, connected with PIC18-based CAN devices).

There is also the canloop(4) pseudo-device, which allows to use the socketcan API without CAN hardware.

At this time the CANFD part of the linux socketcan API is not implemented. Error frames are not implemented either. But I could get the cansend and canreceive utilities from the canutils package to build and run with minimal changes. tcpdump(8) can also be used to record frames, which can be decoded with etherreal.

A review of the code in src/sys/netcan/ is welcome, especially for possible locking issues.''

What CAN devices would you address with NetBSD? Drop me mail!

[Tags: , ]


Disclaimer: All opinion expressed here is purely my own. No responsibility is taken for anything.

Access count: 36037302
Copyright (c) Hubert Feyrer