Forum Discussion

AJuba's avatar
AJuba
Icon for New Contributor rankNew Contributor
7 years ago
Solved

Not Able to Detect CAN Bus on my system

Hello support.

I am not able to detect my CAN bus on my custom board,

this is Cyclone 5 soc device.

Please help.

  • hello AJuba,

    This might fall within 2 reasons:

    1- the CAN bus is not enabled in device tree. to enable this, you need to modify the dts file, it might be something like this:

    can0: can@ffc00000 {

    compatible = "bosch,d_can";

    reg = <0xffc00000 0x1000>;

    interrupts = <0 131 4>, <0 132 4>, <0 133 4>, <0 134 4>;

    clocks = <&can0_clk>;

    status = "disabled";

    };

    can1: can@ffc01000 {

    compatible = "bosch,d_can";

    reg = <0xffc01000 0x1000>;

    interrupts = <0 135 4>, <0 136 4>, <0 137 4>, <0 138 4>;

    clocks = <&can1_clk>;

    status = "disabled";

    };

    both status="disabled" should be enabled if you have 2 CAN buses.

    2- Make sure to enable CAN bus driver in Linux Kernel menuconfig.

    -> Networking Support

    -> <*> CAN Bus Subsystem Support

    -> <*> Raw CAN Protocol

    -> <*> Broadcast Manager CAN Protocol

    -> <*> CAN Gateway/Router

    CAN Device Drivers

    -> <*> Platform CAN drivers with Netlink support

    -> [*] CAN bit-timing calculation

    -> <*> Bosch C_CAN/D_CAN Devices

    -> <*> Generic Platform Bus based C_CAN/D_CAN Driver

    -> [*] CAN devices debugging messages

    Hope this might help.

    Thanks

4 Replies

  • FawazJ_Altera's avatar
    FawazJ_Altera
    Icon for Frequent Contributor rankFrequent Contributor

    hello AJuba,

    This might fall within 2 reasons:

    1- the CAN bus is not enabled in device tree. to enable this, you need to modify the dts file, it might be something like this:

    can0: can@ffc00000 {

    compatible = "bosch,d_can";

    reg = <0xffc00000 0x1000>;

    interrupts = <0 131 4>, <0 132 4>, <0 133 4>, <0 134 4>;

    clocks = <&can0_clk>;

    status = "disabled";

    };

    can1: can@ffc01000 {

    compatible = "bosch,d_can";

    reg = <0xffc01000 0x1000>;

    interrupts = <0 135 4>, <0 136 4>, <0 137 4>, <0 138 4>;

    clocks = <&can1_clk>;

    status = "disabled";

    };

    both status="disabled" should be enabled if you have 2 CAN buses.

    2- Make sure to enable CAN bus driver in Linux Kernel menuconfig.

    -> Networking Support

    -> <*> CAN Bus Subsystem Support

    -> <*> Raw CAN Protocol

    -> <*> Broadcast Manager CAN Protocol

    -> <*> CAN Gateway/Router

    CAN Device Drivers

    -> <*> Platform CAN drivers with Netlink support

    -> [*] CAN bit-timing calculation

    -> <*> Bosch C_CAN/D_CAN Devices

    -> <*> Generic Platform Bus based C_CAN/D_CAN Driver

    -> [*] CAN devices debugging messages

    Hope this might help.

    Thanks

    • Eneko's avatar
      Eneko
      Icon for New Contributor rankNew Contributor

      Hello. We have manged to make CAN0 and CAN1 working but we have a problem with the bus speed. We are getting 3 around 39 kbit/s when configuring 125 kbit/s.

      Although we have 100Mhz clock configured in Preloader and registers in the clock manager, system reports 40Mhz when listing driver configuration (ip -d -s link show can0).

      If we force driver to read 100Mhz clock, we get 15.625 kbit/s, this is, 8 times slower than expected.

      If we force driver to read 12.5Mhz clock, we get correct bus speed.

      The same is hapening with CAN1.

  • AJuba's avatar
    AJuba
    Icon for New Contributor rankNew Contributor

    Hello FJumaah,

    Wow amazing....

    Thanks for your help.​ I was able to solve my problem by following item 1.