dzeko1236
Posts: 9
Joined: Wed Mar 31, 2021 9:45 pm

Cannot find device can0

Mon May 03, 2021 3:55 pm

Hello i need to activate Bus Can on my linux kernel generated by buildroot . I installed drivers and i added "dtparam=spi=on
dtoverlay=mcp2515-can0-overlay,oscillator=16000000,interrupt=25,spimaxfrequency=500000
dtoverlay=spi-bcm2835-overlay" to /rpi-firmware/config.txt . When i try to link can0 by "ip link set can0 type can bitrate *****" i have error "cannot find device can0"
Any help please :oops: :oops: :oops:

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3885
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Cannot find device can0

Tue May 04, 2021 8:35 am

Code: Select all

dtoverlay=mcp2515-can0-overlay,oscillator=16000000,interrupt=25,spimaxfrequency=500000
Drop the "-overlay" - that's not part of the overlay name. Running "sudo vcdbg log msg" should show an error message such as:

Code: Select all

007697.462: Failed to load overlay 'mcp2515-can0-overlay'
The line is also a bit long - there is a limit of just over 80 characters per line. With the correct overlay name of "mcp2515-can0" this shouldn't be a problem, but in case you do run into a similar situation you can split parameters onto separate lines at arbitrary points like this if necessary:

Code: Select all

dtoverlay=mcp2515-can0,oscillator=16000000
dtparam=interrupt=25,spimaxfrequency=500000
or

Code: Select all

dtoverlay=mcp2515-can0
dtparam=oscillator=16000000
dtparam=interrupt=25
dtparam=spimaxfrequency=500000

dzeko1236
Posts: 9
Joined: Wed Mar 31, 2021 9:45 pm

Re: Cannot find device can0

Tue May 04, 2021 2:41 pm

thank you for your reply . Have you another way to solve this ? I try your solution but nothing change .
There is no can0 device . "Cannot find device can0"
Any helps please :oops: :oops:

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3885
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Cannot find device can0

Tue May 04, 2021 3:06 pm

What do the following commands display?:

Code: Select all

$ sudo vcdbg log msg
$ dmesg -l err

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3885
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Cannot find device can0

Tue May 04, 2021 3:32 pm

If you are having trouble gathering the output, try this:

Code: Select all

$ sudo apt install pastebinit
$ (sudo vcdbg log msg; dmesg -l err) |& pastebinit
The second command should end with a message such as:

Code: Select all

http://paste.debian.net/1234567/

dzeko1236
Posts: 9
Joined: Wed Mar 31, 2021 9:45 pm

Re: Cannot find device can0

Sun May 09, 2021 1:11 am

thank you to reply .
the command " sudo vcdbg log msg " return "vcdbg:symbol lookup error:vbg : undefined symbol:openvideocoreMemoryFileWithOffsetAndSize" dmesg -l err return " dmesg: invalid option" .
I think that i have a big problem couldn't solve it.
Any help pleass :oops: :oops:

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3885
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Cannot find device can0

Mon May 10, 2021 7:50 am

OK, just try and capture the output of "dmesg".

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3885
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Cannot find device can0

Mon May 10, 2021 10:46 am

If you have a spare SD card I recommend installing a Raspberry Pi OS image and testing with that card. This will help you to distinguish hardware problems from software problems, and allow you to run the standard debug tools.

Return to “Device Tree”