Bring up CAN1 on VF61

Hi there,

We are trying to bring up the CAN1 interface on a VF61 V1.2A module.

As for now, we have configured the file arch/arm/boot/dts/vf-colibri-eval-v3.dtsi as suggested:

&can1 {
       status = "okay";
};

And as for the Kernel, the CAN modules are OK too:

CONFIG_CAN=m
CONFIG_CAN_RAW=m
CONFIG_CAN_BCM=m
CONFIG_CAN_GW=m
CONFIG_CAN_DEV=m
CONFIG_CAN_CALC_BITTIMING=y
CONFIG_CAN_FLEXCAN=m

In the Linux side, we are loading the CAN modules:

modprobe flexcan
modprobe can
modprobe can_raw
modprobe can_dev

And the CAN1 network interface is set with the command below:

ip link set can0 type can bitrate 500000
ip link set can0 up

But… When I try to send frame through the CAN1, the line is static - nothing is being sent :frowning:

# cansend can0 -i 0x1ff 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88 -v
interface = can0, family = 29, type = 3, proto = 1
id: 511 dlc: 8
0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88

We are analyzing the CAN interface with logic analyzer and even with oscilloscope.

I checked the pinmux, and the pinout is OK, no conflict (until now…?)

        pinctrl_flexcan1: can1grp {
            fsl,pins = <
                VF610_PAD_PTB16__CAN1_RX    0x31F1
                VF610_PAD_PTB17__CAN1_TX    0x31F2
            >;
        };

Is there something we could be missing?

The changes look good to me. I remember testing CAN1 here, so it really should work. Can you double check that pinmux has been applied using:

cat /sys/kernel/debug/pinctrl/pinctrl-handles | grep PTB16
cat /sys/kernel/debug/pinctrl/pinctrl-handles | grep PTB17

What is ip link saying after you enable the bus and after trying to send a frame?

Maybe berr-reporting on helps, check also High performance, low power Embedded Computing Systems | Toradex Developer Center

Hi @stefan.tx,

For each command, I paste here each return:

#  cat /sys/kernel/debug/pinctrl/pinctrl-handles | grep PTB16
type: CONFIGS_PIN controller 40048000.iomuxc pin VF610_PAD_PTB16 (38)config 000031f1
       
#  cat /sys/kernel/debug/pinctrl/pinctrl-handles | grep PTB17
type: CONFIGS_PIN controller 40048000.iomuxc pin VF610_PAD_PTB17 (39)config 000031f2
    
# ip link set can0 type can bitrate 500000
[ 8673.193431] flexcan 400d4000.flexcan can0: bitrate error 0.7%

# ip link set can0 up
[ 8712.706506] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready

# cansend can0 -i 0x1ff 0x1 0x2 0x3 -v
interface = can0, family = 29, type = 3, proto = 1
id: 511 dlc: 3
0x01 0x02 0x03

And, just to be sure, we are analyzing the SODIMM signals 63 and 55 (just to see if there is data being sent/transfered), and also the CAN transceivers for CAN_H and CAN_L. Everything still silent.

Hm, but you do have a valid bus (e.g. after the Transeiver, with Termination)? CAN needs a valid bus, otherwise it won’t be able to detect whether it is allowed to send… And won’t send…

For my tests I usually use a self made DB-9 cables with correct termination, so I can use it after the transceiver and with USB CAN adapter (such as PCAN-USB).

You can create a test bus on 3.3V level, this PDF about On-Board Communication via CAN without Transceiver shows how to do it.

Hi @stefan.tx,

It was a problem with the CAN Transceiver.
The PCB had a wrong resistor…
We fixed it, and everything is working fine now.

Thanks!