CANpie (CAN Programming Interface Environment) is an
open source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
project and pursues the objective of creating and establishing an open and standardized software API for access to the
CAN bus
A Controller Area Network (CAN bus) is a robust vehicle bus standard designed to allow microcontrollers and devices to communicate with each other's applications without a host computer. It is a message-based protocol, designed originally for ...
.
The project was established in 2001 by MicroControl and is licensed under
Apache License version 2.0. The current version of the CANpie API covers both classical CAN frames as well as
ISO CAN FD frames. The API is designed for embedded control applications as well as for PC interface boards: embedded
microcontroller
A microcontroller (MCU for ''microcontroller unit'', often also MC, UC, or μC) is a small computer on a single VLSI integrated circuit (IC) chip. A microcontroller contains one or more CPUs ( processor cores) along with memory and programma ...
s are programmed in C, a C++ API is provided for OS independent access to interface boards. The API provides ISO/OSI Layer-2 (Data Link Layer) functionality. It is not the intention of CANpie to incorporate higher layer functionality (e.g.
CANopen CANopen is a communication protocol and device profile specification for embedded systems used in automation. In terms of the OSI model, CANopen implements the layers above and including the network layer. The CANopen standard consists of an addre ...
,
SAE J1939
Society of Automotive Engineers standard SAE J1939 is the vehicle bus recommended practice used for communication and diagnostics among vehicle components. Originating in the car and heavy-duty truck industry in the United States, it is now wide ...
).
Driver principle
The CANpie API supports the concept of hardware message buffers (mailboxes) with a total limit of 255 buffers. A message buffer has a unique direction (receive or transmit). As an option it is possible to connect a
FIFO with arbitrary size to a message buffer for both transfer directions. The total number of CAN channels is limited to 255, the API provides a method to gather information about the features of each CAN hardware channel. This is especially important for an application designer who wants to write the code only once. The CAN frame time-stamping (specified by
CiA
The Central Intelligence Agency (CIA ), known informally as the Agency and historically as the Company, is a civilian foreign intelligence service of the federal government of the United States, officially tasked with gathering, processing, ...
603, CAN Frame time-stamping – Requirements for network time management) is supported with a resolution of 1 nano-second.
Usage
The following code snippet shows the initialisation of a microcontroller.
#include "cp_core.h" // CANpie core functions
void MyCanInit(void)
Similar projects
For the
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
operating system the projects
can4linux can4linux is an Open Source CAN Linux-Kernel device driver.
Development started in the mid-1990s for the Philips 82C200 CAN controller stand alone chip on an ISA Board AT-CAN-MINI.
In 1995 the first version was created to use the CAN bus with Lin ...
and
SocketCAN
SocketCAN is a set of open source CAN drivers and a networking stack contributed by Volkswagen Research to the Linux kernel. SocketCAN was formerly known as ''Low Level CAN Framework'' (LLCF).
Traditional CAN drivers for Linux are based on th ...
provide support for Classical CAN and ISO CAN FD. The commercial
AUTOSAR specification supports CAN FD since version 4.3 and is available only for AUTOSAR partners. The CMSIS-Driver (Cortex Microcontroller Software Interface Standard) specification is a software API that describes peripheral driver interfaces for middleware stacks and user applications on
ARM
In human anatomy, the arm refers to the upper limb in common usage, although academically the term specifically means the upper arm between the glenohumeral joint (shoulder joint) and the elbow joint. The distal part of the upper limb between t ...
Cortex-M processors.
[{{Cite web, url=https://www.arm.com/products/processors/cortex-m/cortex-microcontroller-software-interface-standard.php, title = Common Microcontroller Software Interface Standard (CMSIS)]
References
External links
CANpie documentationCANpie project siteCAN newsletter 2014-02-25Software Architecture for Modular Self-Reconfigurable Robots, Xerox Palo Alto Research CenterAUTOSAR websitecan4linux project siteSocketCAN project site Patent applied for SocketCAN (German language)iCC 2017 - "CAN driver API - migration from Classical CAN to CAN FD"
CAN bus
Computer-mediated communication
Data transmission
Serial buses