IMX6 Hummingboard - CAN bus
Overview
A Controller Area Network (CAN bus) is a robust vehicle bus standard designed to allow microcontrollers and devices to communicate with each other in applications without a host computer. It is a message-based protocol, designed originally for multiplex electrical wiring within automobiles to save on copper, but is also used in many other contexts. (source wikipedia.com)
Hardware Modification
Notes
- Requires MicroSOM rev 1.4 and newer
- Requires Hummingboard Edge/Gate
- Overlaps with HDMI connector CEC function. So only this or the HDMI connector can be assembled
In order to get the canbus up and running, following hardware modifications need to be done:
- Disassemble D5 and the HDMI connector
- Assemble:
- R54
- R53
- C100
- U10003 (CAN transceiver , for example TJA1050)
- R55
- L12
- L13
- C101
- C102
- L13
- J28
per the HummingBoard2 schematics: Hummingboard Documents
Software Modification
Device Tree Changes
Edit following lines in the Device tree
- Disable HDMI-CEC by setting status = “disabled” - in Github DeviceTree
- Enable Flexcan1 in Github DeviceTree
(Re-)Compile DeviceTree
Generically speaking, the raw .dts files can be compiled into .dtb using the device-tree-compiler dtc. The most straightforward way to invoke it is by configuring the linux kernel tree, and then running
make dtbs
The kernel-tree needs to be configured first. Please refer to IMX6 Kernel for generic instructions, or consult the distro documentation
(Re-)Compile Linux Kernel
Either recompile linux kernel with config :
CONFIG_CAN=y CONFIG_CAN_RAW=y CONFIG_CAN_DEV=y CONFIG_CAN_FLEXCAN=y
or activate modules:
modprobe can modprobe flexcan modprobe can-dev modprobe can-raw
Test CanBUS
Enable device can0:
ip link set can0 up type can bitrate xxxxxx
(ex:125000)
Checking:
ip -details link show can0
The easiest way to test the CanBUS is to use the CAN-Utils, which are available for Debain/Ubuntu etc.
Example commands:
Sending:
cansend can0
receiving:
candump can0