AM335X DCAN Driver Guide

am335x

 * DCAN is available in Profile #1 of AM335X EVM with General purpose daughter card, go through EVM hardware user guide to know how to set different profiles. Transceiver port number on the daughter card is J11 and below figure is for reference




 * 3
 * arch/arm/mach-omap2/board-am335xevm.c
 * DCAN board specific data addition
 * 4
 * arch/arm/mach-omap2/devices.c
 * DCAN soc specific data addition
 * }
 * DCAN soc specific data addition
 * }

= Miscellaneous =

Support for second D_CAN instance (AM335x)
On AM335x EVM only D_CAN1 is supported. Hence in arch/arm/mach-omap2/board-am335xevm.c only D_CAN1 is support is enabled by default. To add support for D_CAN0 on your custom board, follow these steps. Add pinmux configurations

Add a pinmux_config structure in your custom AM335x board file for instance 0. AM335x SoC provides multiple options for D_CAN0 pins. Refer to the schematic of your board to find which exact D_CAN0 pins are connected to the transceiver. In the example below, we assume pin UART0 RXD (primary function) is used as D_CAN0 TX pin and UART0 TXD (primary function) is used as D_CAN0 RX pin.

static struct pinmux_config d_can0_pin_mux[] = { {"uart0_rxd.d_can0_tx", OMAP_MUX_MODE2 | AM33XX_PULL_ENBL}, {"uart0_txd.d_can0_rx", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP}, {NULL, 0}, };

Now, call the setup_pin_mux API to affect these mux configurations. This has to be done inside the d_can_init API in arch/arm/mach-omap2/board-am335xevm.c, which is called from the board initialization code.

setup_pin_mux(d_can0_pin_mux);

Registering platform device

Next, the D_CAN0 platform device needs to be registered. For this, just call am33xx_d_can_init with instance number argument passed as 0. This also needs to be done in the board initialization sequence.

am33xx_d_can_init(0);

You are now all set to test the second D_CAN instance. Note that the CAN instance which is registered first appears as can0 irrespective of which instance number it corresponds to. The second CAN instance appears as can1.