The ConnectCore 8M Mini system-on-module has no native CAN ports.

The ConnectCore 8M Mini Development Kit incorporates an external MCP2518FD CAN FD controller with SPI interface, available for peripheral use. This external CAN controller implements the CAN protocol according to the CAN-FD 3.0 protocol specification. It also supports legacy CAN 2.0B protocol specification. The controller can operate on both CAN-FD (flexible data rate) and legacy CAN modes.

CAN-FD protocol supports two different bitrates for the arbitration phase and the payload phase, and up to 64 Bytes of payload, achieving higher throughput than classical CAN protocol.

The CAN port includes the following features:

  • Standard data and remote frames

  • Extended data and remote frames

  • Mixed controller mode (CAN FD and CAN 2.0B)

    • Arbitration bitrate up to 1 Mbps

    • Data bitrate up to 8 Mbps

    • Payload length up to 64 bytes

  • CAN 2.0B controller mode

    • Arbitration and data bitrates up to 1 Mbps

    • Payload length up to eight bytes

The CAN driver is a network device driver.

Available CAN interfaces

  • CAN0:

    • Interface is enabled in the default device tree.

    • Port lines are available on the CAN connector J24.

    • Port incorporates a CAN transceiver.

    • Optional termination line resistor can be connected by placing a jumper on connector J23.

Kernel configuration

You can manage the CAN support through the kernel configuration options:

  • CAN Bus support (CONFIG_CAN)

  • Microchip MCP25xxFD SPI CAN controllers (CONFIG_CAN_MCP25XXFD)

These options are enabled as built-in on the default ConnectCore 8M Mini kernel configuration file.

Kernel driver

File Description

drivers/net/can/spi/mcp25xxfd/mcp25xxfd_base.c

Microchip MCP2517 driver

CAN support on the ConnectCore 8M Mini Development Kit is based on the SocketCAN stack. For more information and source code about this project, see http://elinux.org/CAN_Bus and https://github.com/linux-can/.

Device tree bindings and customization

The Microchip MCP2517 CAN controller device tree binding is documented at Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.txt

Example: CAN0 on the ConnectCore 8M Mini Development Kit

ConnectCore 8M Mini Development Kit device tree
/* fixed crystal dedicated to mcp2517fd */
mcp2517fd_osc: mcp2517fd_osc {
	compatible = "fixed-clock";
	#clock-cells = <0>;
	clock-frequency = <40000000>;
};

[...]

&ecspi3 {
	[...]

	mcp2517fd: mcp2517fd@0 {
		reg = <0>;
		compatible = "microchip,mcp2517fd";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_mcp2517fd>;
		spi-max-frequency = <20000000>;
		interrupt-parent = <&gpio1>;
		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
		clocks = <&mcp2517fd_osc>;
		xceiver-supply = <&reg_5v_board>;
	};
};

[...]

&iomuxc {
	pinctrl_mcp2517fd: mcp2517fdgrp {
		fsl,pins = <
			MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0 0x19
		>;
	};
};

Using the CAN interface

You can access CAN interfaces from your Android application. See CAN API for more information about the CAN APIx.

Sample application

The CAN Sample Application demonstrates the use of the CAN API. In this example, you can configure all the settings of the CAN interface, write, and read data from the port.

Go to GitHub to see the application instructions and source code.