This is a guide to the
can C example project included in the EMAC OE SDK.
A Controller Area Network (CAN bus) is a robust bus standard for in-vehicle networks. Originally designed for use in the automotive industry, CAN allows micro-controllers and devices to communicate through a message-based protocol with device priority and is used in many different applications to this day.
This project serves as a demonstration of using the CAN bus.
can project builds one executable:
Opening, Building and Uploading the Project Files
For information on opening the project from within Eclipse, please see Importing the EMAC OE SDK Projects with Eclipse. Then, follow Using the EMAC OE SDK Projects with Eclipse for information on how to build, upload and execute the example.
Makefile can be used with the
make command from the commandline to build and upload the example. For information on this method, please see Using EMAC OE SDK Example Projects.
EMAC SDK 5.X
For information on opening the project from within QtCreator, please see QtCreator: Adding Source Files. Then, follow Getting Started With Qt Creator for information on how to build, upload and execute the example.
CMakefile.txt can be used with the
cmake command from the commandline to build and upload the example. For information on this method, please see Getting Started with the EMAC OE SDK.
Usage and Behavior
It should run just fine on any device with a CAN interface. You will need:
- Two devices with a CAN interface
can program is executed from the console. Requires either the argument "send" or "receive"
The program will wait for data payload to be received (argument: "receive") through CAN or send data payload (argument: "send"), 8 random hex bytes, through CAN. The payload will then be printed on the receive end.
Prepare Device 1 to receive:
root@ipac9x25:~# ./can receive .
Send Data from Device 2:
root@somimx6ul:~# ./can send root@somimx6ul:~#
Device 1 received:
root@ipac9x25:~# ./can receive <0x001>  87 5a 6a 37 7a 94 a4 01 root@ipac9x25:~#
can C example project demonstrates the use of the CAN bus.