I.MX6 UDOO CAN BUS

Discussion in 'UDOO QUAD' started by sam7281, Dec 25, 2016.

Tags:
  1. sam7281

    sam7281 New Member

    Joined:
    Nov 2, 2016
    Messages:
    7
    Likes Received:
    0
    How can i open I.MX6 UDOO CANbus?
    I test this code

    pinctrl_flexcan1: flexcan1grp {
    fsl,pins = <
    MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x80000000
    MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x80000000
    >;
    };

    &flexcan1 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_flexcan1>;
    trx-stby-gpio = <&gpio4 5 GPIO_ACTIVE_LOW>;
    status = "okay";
    };


    LOOPBACK is work But I link real can device can't work,Why?

    udooer@udoo:~$ ip -s -d link show can0
    3: can0: <NO-CARRIER,NOARP,UP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
    link/can promiscuity 0
    can state BUS-OFF (berr-counter tx 0 rx 0) restart-ms 0
    bitrate 625000 sample-point 0.750
    tq 200 prop-seg 2 phase-seg1 3 phase-seg2 2 sjw 1
    flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
    clock 30000000
    re-started bus-errors arbit-lost error-warn error-pass bus-off
    0 0 0 1 1 1
    RX: bytes packets errors dropped overrun mcast
    16 2 0 0 0 0
    TX: bytes packets errors dropped carrier collsns
    0 0 0 0 0 0
     
    Last edited: Dec 25, 2016
  2. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    You need to ensure:

    1. GPIO_7 and GPIO_8 are disabled as GPIO pins in your dts files (see mx6qdl-udoo-externalpins.dtsi).
    2. GPIO_7 and 8 are correctly IOMUXED
    Code:
    pinctrl_flexcan1: can1grp {
    fsl,pins = <
    MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x1b0b1
    MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x1b0b1
    >;
    };
    
    3. The CAN transceiver pins are correctly connected to the UDOO and the bus.
    4.. A 120 ohm resistor is present on the transceiver.
     
    Last edited: Dec 26, 2016
    tappen-1 likes this.
  3. sam7281

    sam7281 New Member

    Joined:
    Nov 2, 2016
    Messages:
    7
    Likes Received:
    0
    Thank you for your reply
    Yes I change 0x1b0b1 ,I check flexcan1 status is okay(work)&my transceiver is TJA1050
    But When I.mx6q can rx tx link ,It will be displayed ERROR-WARNING,
    If I disconnect rx tx It will be displayed ERROR-OFF.
    I also use the can device to test, But not any reaction
    Why?
    Code:
    can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT
    group default qlen 10
        link/can  promiscuity 0
        can state ERROR-WARNING (berr-counter tx 0 rx 132) restart-ms 0
        bitrate 625000 sample-point 0.750
        tq 200 prop-seg 2 phase-seg1 3 phase-seg2 2 sjw 1
        flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
        clock 30000000
        re-started bus-errors arbit-lost error-warn error-pass bus-off
        0          0          0          0         1          1
        RX: bytes  packets  errors  dropped overrun mcast
        8        1       0       0       0       0
        TX: bytes  packets  errors  dropped carrier collsns
        0          0        0       1      0       0
    
    The following need to remove ??
    Code:
    MX6QDL_PAD_GPIO_8__GPIO1_IO08        0x80000000  // {{external-gpio-54}}
    MX6QDL_PAD_GPIO_7__GPIO1_IO07        0x80000000  // {{external-gpio-55}}
    


    Thank you for your help!!
     
  4. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    The CAN interface has entered the the ERROR-WARNING state because the rx error count is 132 (for frames it couldn't receive ). From the error it would suggest that the transceiver is not able to send/receive correctly on the bus it is connected too. Unfortunately this could be due to a multitude of reasons.

    Your bitrate is 625K, is that correct?
    Are the can tx/rx pins connected the right way round to the TJA1050?

    You can comment this out in the dts file as the pins are reassigned for CAN.
     
  5. sam7281

    sam7281 New Member

    Joined:
    Nov 2, 2016
    Messages:
    7
    Likes Received:
    0
    625K is correct, CAN tx / rx is also correct to receive TJA1050 tx / rx
    In its CAN devices to TJA1050 tx / rx is OK.
    Do you have normal CAN BUS test on UDOO I.MX6Q?
     
  6. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    You need to connect it to a bus with a can device to validate it works. If you have a device that works at 125/500K then test with that. Furthermore you can verify with loop back mode however it doesn't verify the transceiver/bus is functioning (which is seems to be the problem area).

    Alternatively If you have a spare TJA1050 you connect this to SAM3X8E and write some custom code to enable the can interface (see this thread). Once you have that working you can connect both TJA1050 together and verify you can send/receive packets from the imx6 side.
     
  7. sam7281

    sam7281 New Member

    Joined:
    Nov 2, 2016
    Messages:
    7
    Likes Received:
    0
    Yes,I use (USB to CAN BUS device) test,but UDOO CAN BUS still no work

    I asked UDOO customer service, they said that as long as the use of http://www.udoo.org/docs/Cookbook_Linux/Device_Tree_Editor.html
    Like failure
     
  8. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    If you set the IOMUX back to :

    MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x80000000
    MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x80000000

    and loopback mode works but not with your transceiver then I'd also check that the TJA1050 was tolerant to 3.3v on tx/rx pins, see app note section 3.4, the uC rx/tx pins have to be 5v tolerant. Its safer to use a SN65HVD230 otherwise you risk damaging the UDOO.
     
  9. sam7281

    sam7281 New Member

    Joined:
    Nov 2, 2016
    Messages:
    7
    Likes Received:
    0
    I tried .same result
    Is it really easy to use a CAN bus?
    What direction can go to check it?
     
  10. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    You should test with a 3.3v compliant transceiver (eg SN65HVD230), the TJA1050 isn't fully compliant with 3.3v level (its tolerant to 5v) so the udoo rx/tx pins may have already been damaged when you connected it.
     
  11. sam7281

    sam7281 New Member

    Joined:
    Nov 2, 2016
    Messages:
    7
    Likes Received:
    0
    I replaced SN65HVD230, Udoo also replaced by a new one.
    But I send command "cansend can0 500#1E.00.10" Will become BUS OFF
    Why?
    Has anyone succeeded in this board?
     

    Attached Files:

  12. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    Can you provide the output if you send data to the udoo from another CAN device (assume 500K bitrate) as below:

    Code:
    ip link set can0 type can bitrate 500000
    ifconfig can0 up
    ip -s -d link show can0
    candump can0
    
     
    Last edited: Jan 7, 2017
  13. sam7281

    sam7281 New Member

    Joined:
    Nov 2, 2016
    Messages:
    7
    Likes Received:
    0
    I tried, it can not receive any signal
    There may be driven by its own did not write, resulting in this did not work?
     
  14. Mario Pieschel

    Mario Pieschel UDOOer

    Joined:
    Jan 3, 2020
    Messages:
    3
    Likes Received:
    1

Share This Page