Discussion in 'UDOO QUAD' started by asusrog, Mar 26, 2018.

  1. asusrog

    asusrog New Member

    Apr 28, 2014
    Likes Received:

    I am currently having issues getting UDOO's flexcan working.

    Following is the yocto build configuration i am using. (meta-udoo krogoth branch)

    Build Configuration:
    BB_VERSION = "1.30.0"
    BUILD_SYS = "x86_64-linux"
    NATIVELSBSTRING = "universal"
    TARGET_SYS = "arm-poky-linux-gnueabi"
    MACHINE = "udooqdl"
    DISTRO = "poky"
    DISTRO_VERSION = "2.1.3"
    TUNE_FEATURES = "arm armv7a vfp thumb neon callconvention-hard cortexa9"
    TARGET_FPU = "hard"
    meta-poky = "HEAD:444dc2e99b3c3967d9f83380c34bb99077a6ffa8"
    meta-networking = "HEAD:55c8a76da5dc099a7bc3838495c672140cedb78e"
    meta-ros = "master:e2566402ab108a19634354a934788109422cf409"
    meta-fsl-arm = "HEAD:e2254e7b2ded0c2b66b1226f879b3a6d52037b2d"
    meta-fsl-arm-extra = "HEAD:2c28e636ec15c2cfd49bc9cebe0bbbcfde95bc7b"
    meta-fsl-demos = "HEAD:a165068f8a0d1cf29aabe4b4053f28be1c2aa492"
    meta-udoo = "HEAD:a01cfce52c52fc942eab4375cd249795ca24c53f"

    I've used the following patch to enable the can bus

    From 3d23716944adbe2495a786d0021288d8a9624e67 Mon Sep 17 00:00:00 2001
    From: Mohammed talha <mohammedtalha89@gmail.com>
    Date: Fri, 9 Mar 2018 01:11:52 +0530
    Subject: [PATCH] arch/arm/boot/dtc/im6qdl-udoo-externalpins.dtsi - Added CAN

    arch/arm/boot/dts/imx6qdl-udoo-externalpins.dtsi | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    diff --git a/arch/arm/boot/dts/imx6qdl-udoo-externalpins.dtsi b/arch/arm/boot/dts/imx6qdl-udoo-externalpins.dtsi
    index b45b5eb..34b5a3b 100644
    --- a/arch/arm/boot/dts/imx6qdl-udoo-externalpins.dtsi
    +++ b/arch/arm/boot/dts/imx6qdl-udoo-externalpins.dtsi
    @@ -66,8 +66,8 @@
    MX6QDL_PAD_EIM_CS1__GPIO2_IO24 0x80000000 // {{external-gpio-51}}
    MX6QDL_PAD_EIM_CS0__GPIO2_IO23 0x80000000 // {{external-gpio-52}}
    MX6QDL_PAD_EIM_D24__GPIO3_IO24 0x80000000 // {{external-gpio-53}}
    - MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x80000000 // {{external-gpio-54}}
    - MX6QDL_PAD_GPIO_7__GPIO1_IO07 0x80000000 // {{external-gpio-55}}
    + //MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x80000000 // {{external-gpio-54}}
    + //MX6QDL_PAD_GPIO_7__GPIO1_IO07 0x80000000 // {{external-gpio-55}}

    @@ -161,7 +161,7 @@
    &flexcan1 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_flexcan1>;
    - status = "disabled";
    + status = "okay";

    &usdhc1 {

    It seems to work. Since i get the following CAN related log in my dmesg output

    : dmesg | grep 'can'
    [ 1.156890] ahci-imx 2200000.sata: SSS flag set, parallel bus scan disabled
    [ 7.759429] 2090000.can supply xceiver not found, using dummy regulator
    [ 7.767589] flexcan 2090000.can: device registered (reg_base=c0ae8000, irq=142)
    [ 85.230994] flexcan 2090000.can can0: writing ctrl=0x0e312005
    [ 376.099239] can: controller area network core (rev 20120528 abi 9)
    [ 376.120856] can: raw protocol (rev 20120528)
    [ 1347.862670] flexcan 2090000.can can0: writing ctrl=0x0e313055
    [ 1347.868676] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready

    Line 2 of the dmesg output says supply transceiver not found. Is there something missing in my device tree configuration. I have tried can-utils. candump is able to echo back the msgs sent using cansend when loopback is enabled. But Scope probing shows no activity on the Tx and Rx pins. I have tried using sn65hvd230 can transceiver without any success. The same transceiver works fine on other stm32 devices. Please do let me know if there is something that i could try in order to get this working.
  2. Mario Pieschel

    Mario Pieschel UDOOer

    Jan 3, 2020
    Likes Received:
    The UDOO hardware is good bud the software and the documentation is wrong!
    IMX6 part:
    In the Udoo_pinout_diagram is CANTX gpio8 (J15 pin 8) and CANRX gpio7 (J15 pin 7).
    In the schematic the same.
    Bud in the device tree file is
    Uups UDOO wat is correct!?

    next SAM3X part:
    In the device tree editor, after setting the CAN BUS pins 54 and 55 and saving, it tells that in Arduino, I have to set
    pinMode(54, INPUT);
    pinMode(55, INPUT);

    In the file variant.h line 91/92
    static const uint8_t CANRX = 68;
    static const uint8_t CANTX = 69;
    Uups UDOO wat is correct!?

    After switching the pins 7 and 8 of J15 and changing the port pin numbers in the arduino source file to
    pinMode(68, INPUT);
    pinMode(69, INPUT);

    It works fine.

    I use the CAN transiver TJA1051/3 (VCC = 5V, Vio = 3.3V) and in /etc/network/interfaces
    auto can0
    iface can0 inet manual
    pre-up ip link set $IFACE type can bitrate 250000 listen-only off
    up /sbin/ifconfig $IFACE up
    down /sbin/ifconfig $IFACE down

    I hope this helps.

    UDOO: Thank you for wasting tree days of my live time!
    waltervl likes this.
  3. Rezendes

    Rezendes New Member

    Dec 15, 2021
    Likes Received:
    CANBUS is a high-speed network which requires high quality wiring in order to operate properly. As such, it is sensitive to improper wiring. The majority of CANBUS communication problems are caused by poor wiring, incorrect termination, or the use of multiple frequencies on the same bus.

Share This Page