FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
6125 Discussions

Not Able to Detect CAN Bus on my system

AJuba
Beginner
2,014 Views

Hello support.

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

this is Cyclone 5 soc device.

 

Please help.

0 Kudos
1 Solution
Fawaz_Al-Jubori
Employee
1,132 Views

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

View solution in original post

0 Kudos
4 Replies
AJuba
Beginner
1,132 Views

Anyone can help me on this?

0 Kudos
Fawaz_Al-Jubori
Employee
1,133 Views

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

0 Kudos
Eneko
Beginner
1,125 Views

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. 

 

0 Kudos
AJuba
Beginner
1,132 Views

Hello FJumaah,

Wow amazing....

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

0 Kudos
Reply