CANpie (CAN Programming Interface Environment) is an
open source 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 mu ...
.
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
microcontrollers 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 address ...
,
SAE J1939).
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, w ...
operating system the projects
can4linux and
SocketCAN 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 th ...
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