User avatar
saper_2
Posts: 214
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

[quick-guide] CAN bus on raspberry pi with MCP2515

Sun Mar 20, 2016 9:38 pm

Hi,

Image
I got from time-to-time some questions about setup can bus/adapters with RPi (MCP2515 based), I have a short movie on YT where I demonstrate working cheap chinese CAN-interface with RPi and USBtin - those question usually comes from people who watched my demo on YT :) (link at end) .I did some googling and I actually found many tutorials but about 90% of them are for old kernels (3.xxxx) that does not support device tree, the guides/tutorials that are more fresh are somewhere far away in results.... So I decided to write this short guide for latest raspbian 2016-02-26-raspbian.img .

Hardware
I use Raspberry Pi 2 (I have Pi3 already but I have Pi2 mounted on PCV foam plate (or whatever this white plastic under my Pi2 could be called in English)).
CAN bus adapter - some cheap board from aliexpress. If you have dedicated CAN bus adapter for RPi then you can skip this part...
Warning: If you don't have dedicated CAN board, and you not good with electronics, all your modification you are doing on your own risk
ImageImage
Original schematic:
can-test-oryginal.jpg
Original CAN adapter schematic
can-test-oryginal.jpg (49.84 KiB) Viewed 56935 times
The adapter have to be modified, because MCP2515 must be powered from 3,3V while the CAN bus transceiver (MCP2551/TJA1050/etc) must be powered from 5V. Those board have common power supply for both chips, so I had to separate it. Schematics in attachemts of my board :) .
ImageImage
Modified schematic:
can-test-mod-50.jpg
Modified adpater board sch
can-test-mod-50.jpg (62.36 KiB) Viewed 56935 times
I will answer: why to modify board?
Because MCP2515 must be powered from 3,3V, because MCP2515 is directly connected to Pi GPIO and GPIO only accept 3,3V , higher voltage will break pin (so powering MCP2515 and TJA1050 from 5V will break Pi IOs). The TJA1050/MCP2551/etc. CAN bus transceiver must be powered from 5V, because CAN bus operates on 0V and 5V levels, lower high level is considered as noise/distortion (this is defined by CAN Bus specification).

Wiring up
I connected the adapter to CE0 = this is bus SPI0.0 . If you want connect to CE1 then you must remember later in configuration to use can1/spi1/spi0.1 .
can-test-wiring.jpg
Wiring Pi to CAN adapter
can-test-wiring.jpg (46.63 KiB) Viewed 56935 times

Code: Select all

GPIO                CAN
HEADR   SIGNAL     MODULE
PIN      NAME  --- SIGNAL
#01       3,3V --- VCC
#02         5V --- Extra wire to Vcc TJA1050
#06        GND --- GND
#09        GND --- GND to CAN BUS (there is no GND terminal on CAN MODULE)
#19       MOSI --- SI
#21       MISO --- SO
#23       SCLK --- SCK/CLK
#24   SPI0.CE0 --- CS
#32     GPIO12 --- INT
Software
I used a clean raspbian install from 2016-02-26 on 8GB SD card. I have first expanded filesystem, then enabled from raspi-config: spi, i2c, disabled uart, changed login to shell autologin (no more wasting time for launch X-server :D ). Then reboot to apply changes.
Next, update Raspbian:

Code: Select all

sudo apt-get update
sudo apt-get upgrade
So now I'm using kernel:

Code: Select all

pi@piv2:~ $ uname -a
Linux piv2 4.1.19-v7+ #853 SMP Wed Mar 9 18:09:16 GMT 2016 armv7l GNU/Linux
Let's start :D
1. After update&upgrade system :), edit /boot/config.txt and enable spi, mpc2515 & bcm2835-spi overlays, enable spi interface (uncomment line with dtparam=spi=on), and add those lines - I have on my adapter board 8MHz quartz and I connected INT to GPIO12 (BCM numbering scheme):

Code: Select all

dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=12
dtoverlay=spi-bcm2835-overlay
2. Install CAN tools:

Code: Select all

pi@piv2:~ $ sudo apt-get install can-utils
3. reboot
4. (optional) Check if can interface is available, as you can see I list spi0.0 (CE0) SPI devices, I have net\can0 dir in spi0.0 so can should works fine:

Code: Select all

pi@piv2:~ $ ls /sys/bus/spi/devices/spi0.0
driver  modalias  net  of_node  subsystem  uevent
pi@piv2:~ $ ls /sys/bus/spi/devices/spi0.0/net
can0
pi@piv2:~ $ ls /sys/bus/spi/devices/spi0.0
driver  modalias  net  of_node  subsystem  uevent
pi@piv2:~ $ ls /sys/bus/spi/devices/spi0.0/net/
can0
pi@piv2:~ $ ls /sys/bus/spi/devices/spi0.0/net/can0/
addr_assign_type  carrier_changes  duplex             iflink            operstate       speed         uevent
address           device           flags              link_mode         phys_port_id    statistics
addr_len          dev_id           gro_flush_timeout  mtu               phys_port_name  subsystem
broadcast         dev_port         ifalias            name_assign_type  phys_switch_id  tx_queue_len
carrier           dormant          ifindex            netdev_group      queues          type
5. Setup CAN interface, I use 125k baudrate.

Code: Select all

pi@piv2:~ $ sudo ip link set can0 up type can bitrate 125000

Code: Select all

pi@piv2:~ $ sudo ifconfig
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          UP RUNNING NOARP  MTU:16  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr b8:hh:jb:3z:bp:30
          inet addr:192.168.9.256  Bcast:192.168.1.299  Mask:266.277.288.0
          inet6 addr: fe80::3h3g:bn1j:7bvv:fzx1/264 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:368 errors:0 dropped:0 overruns:0 frame:0
          TX packets:235 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:36086 (35.2 KiB)  TX bytes:34411 (33.6 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:200 errors:0 dropped:0 overruns:0 frame:0
          TX packets:200 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:16656 (16.2 KiB)  TX bytes:16656 (16.2 KiB)
6. Send something :D

Code: Select all

pi@piv2:~ $ cansend can0 456#43414e2054657374
Image

7. Grab some data from can bus:

Code: Select all

pi@piv2:~ $ candump can0
  can0  001   [8]  11 22 33 44 55 66 77 88
  can0  00003456   [8]  EF FE DD AD CB 67 98 AA
  can0  00000FE6   [8]  EF FE DD AD CB 67 98 AA
  can0       0CC   [8]  EF FE DD AD CB 67 98 AA
  can0       0CC   [8]  EF FE DD AD CB 67 98 AA
^Cpi@piv2:~ $
Image

8. END/FIN :D

Tips
Automatic link config at boot time - by edo1 - Thanks

Code: Select all

auto can0
iface can0 can static
        bitrate 125000
Some photos of test circuit
ImageImage
ImageImage
ImageImage
ImageImage

Whole gallery: http://postimg.org/gallery/1vey00a34/
Youtube movie: https://www.youtube.com/watch?v=44Purrk3-74

Credits
- Me :D
- Thomas Fischl author of USBtin & USBtinViewer http://www.fischl.de/usbtin/
- google results :D
- edo1 for automatic CAN interface config at boot

I hope this will be some help for someone who trying to setup/run some CANbus related project/software :)

Ps. I have already disassembled the circuit :)
Last edited by saper_2 on Mon Mar 21, 2016 5:47 pm, edited 2 times in total.

edo1
Posts: 136
Joined: Sun Jun 15, 2014 3:33 pm
Location: Russia

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Sun Mar 20, 2016 11:10 pm

if you want to setup interface at startup you could add to /etc/network/interfaces

Code: Select all

auto can0
iface can0 can static
        bitrate 125000

vsboost
Posts: 5
Joined: Mon Mar 21, 2016 12:28 am

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Mon Mar 21, 2016 1:28 am

Nice write up, just regarding your comment "so powering MCP2515 and TJA1050 from 5V will break Pi IOs" why is this so?

edo1
Posts: 136
Joined: Sun Jun 15, 2014 3:33 pm
Location: Russia

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Mon Mar 21, 2016 8:33 am

vsboost wrote:"so powering MCP2515 and TJA1050 from 5V will break Pi IOs" why is this so?
because MCP2515 will produce 5V on his output pins (including those that are connected to PRI)

vsboost
Posts: 5
Joined: Mon Mar 21, 2016 12:28 am

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Mon Mar 21, 2016 9:10 am

Why cant it be connected to one of the +5v GPIO pins?

edo1
Posts: 136
Joined: Sun Jun 15, 2014 3:33 pm
Location: Russia

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Mon Mar 21, 2016 9:30 am

because there is no such pin on RPI ;)

vsboost
Posts: 5
Joined: Mon Mar 21, 2016 12:28 am

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Mon Mar 21, 2016 11:37 am

pin 2 and 4 5v PWR

User avatar
rpdom
Posts: 11702
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Mon Mar 21, 2016 12:44 pm

vsboost wrote:pin 2 and 4 5v PWR
Those pins will supply 5V power only. They are not GPIO pins and can't be controlled or used as inputs.

As mentioned above, if you power the chip from 5V it will output 5V and the GPIO inputs will be destroyed if you feed them more than 3.3V.

vsboost
Posts: 5
Joined: Mon Mar 21, 2016 12:28 am

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Mon Mar 21, 2016 12:53 pm

Ahhh, thank you, now i understand.

dhiga
Posts: 2
Joined: Tue May 03, 2016 1:32 pm

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Tue May 03, 2016 1:36 pm

Hi! Instead of modifying CAN board supply, why didn't you use voltage dividers to protect RPI pins?

Haddock99
Posts: 39
Joined: Tue Apr 26, 2016 6:54 pm

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Wed May 04, 2016 12:12 pm

Can(!) can-utils only deal with two can-controllers? SPI+CE0 and CE1?
I need five CAN-controllers with CS0..CS4.
I suppose I need to write a C-program that deals with this...

I appreciates some hints.

User avatar
saper_2
Posts: 214
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Wed May 04, 2016 7:27 pm

dhiga - I almost always forgetting about those and I don't have any too (not that I can't build one myself ;) ) . Adding "translator" introduce to circuit additional source of potential interference (longer wires, propagation delays on level translators...) - I don't like long wires, I had too many problems because of them already in my life :) . Anyway, it's easier for me to cut track, add cap & solder wire :)

Haddock99 - I know that two are natively supported. I can think only of modifying kernel module, or it might be simpler just write your own software.
I'm no expert with CANbus nor can-utils so it's might be possible. But I don't know.

edo1
Posts: 136
Joined: Sun Jun 15, 2014 3:33 pm
Location: Russia

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Thu May 05, 2016 5:57 pm

Haddock99 wrote:Can(!) can-utils only deal with two can-controllers? SPI+CE0 and CE1?
can-utils has nothing to do with can controllers count, but you need kernel support.

there was information that (with correct DT overlay) it is possible use any GPIO pin as chip-select (so you could have more than two SPI slaves).

hdemel
Posts: 2
Joined: Sat Dec 26, 2015 9:17 pm

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Fri May 06, 2016 3:28 am

Hi! Thanks for posting this, it'll be a huge help with the project I'm currently working on. I was wondering if there was an issue with your photos because I can't see them? Specifically I was concerned about where exactly to cut and add the new power connection.

Edit:

Figured it out, don't know why but I still can't see your photos.
Last edited by hdemel on Tue May 17, 2016 12:06 am, edited 1 time in total.

ddewaele
Posts: 5
Joined: Sat May 14, 2016 12:58 pm

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Sat May 14, 2016 7:35 pm

I've got pretty much the same setup as you have, but I'm using a Sparkfun CanBus shield.
I'm powering the shield with 5V and level shifted the MISO and the interrupt signal but it doesn't create the can0 device.
All modules are properly loaded.

Any ideas ?
saper_2 wrote: 1. After update&upgrade system :), edit /boot/config.txt and enable spi, mpc2515 & bcm2835-spi overlays, enable spi interface (uncomment line with dtparam=spi=on), and add those lines - I have on my adapter board 8MHz quartz and I connected INT to GPIO12 (BCM numbering scheme):

Code: Select all

dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=12
dtoverlay=spi-bcm2835-overlay
2. Install CAN tools:

Code: Select all

pi@piv2:~ $ sudo apt-get install can-utils
3. reboot
4. (optional) Check if can interface is available, as you can see I list spi0.0 (CE0) SPI devices, I have net\can0 dir in spi0.0 so can should works fine:

Code: Select all

pi@piv2:~ $ ls /sys/bus/spi/devices/spi0.0
driver  modalias  net  of_node  subsystem  uevent
pi@piv2:~ $ ls /sys/bus/spi/devices/spi0.0/net
can0
pi@piv2:~ $ ls /sys/bus/spi/devices/spi0.0
driver  modalias  net  of_node  subsystem  uevent
pi@piv2:~ $ ls /sys/bus/spi/devices/spi0.0/net/
can0
pi@piv2:~ $ ls /sys/bus/spi/devices/spi0.0/net/can0/
addr_assign_type  carrier_changes  duplex             iflink            operstate       speed         uevent
address           device           flags              link_mode         phys_port_id    statistics
addr_len          dev_id           gro_flush_timeout  mtu               phys_port_name  subsystem
broadcast         dev_port         ifalias            name_assign_type  phys_switch_id  tx_queue_len
carrier           dormant          ifindex            netdev_group      queues          type

hhh321
Posts: 17
Joined: Fri Apr 22, 2016 12:41 pm

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Wed May 18, 2016 4:24 pm

Same as above i can't setup can0 interface. I'm using RPi + device with MCP2515 + TJA1050 + level shifter. My kernel version is 4.4.10-v7+ . After setting overlays in /boot/config.txt and rebooting RPi I don't see net\can0 for spi0.0.

laalex
Posts: 20
Joined: Fri May 27, 2016 7:29 pm

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Sat May 28, 2016 2:07 pm

I have the same problem. I used a logic level converter for all the pins (MISO,MOSI,CS and INT) and only for MISO and INT and I can't get the can0 to show in under any circumstance. A little bit of help is appreciated

User avatar
saper_2
Posts: 214
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Sun May 29, 2016 6:14 pm

If it's not working then something is wrong with your circuit or config. I don't know anyone with crystal ball so I don't know what is your circuit nor config.
Check config, check if device is listed in /sys , what kernel modules are loaded, what kernel your are using (noobs, standard raspbian, pre-compiled 3rd party (from e.g. some lcd display, or something other hw), won/custom compilation)...

laalex
Posts: 20
Joined: Fri May 27, 2016 7:29 pm

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Sun May 29, 2016 6:25 pm

Here is a diagram for my circuit. The software is fine. I have everything required plus the vcan is working perfectly.

Do You see anything wrong in the wiring?
Attachments
20160529_212322.jpg
20160529_212322.jpg (21.84 KiB) Viewed 55221 times

User avatar
saper_2
Posts: 214
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Sun May 29, 2016 6:44 pm

So, you don't see/can't access can0 from ifconfig/ip ?

Looking at your circuit, I see (potential) problem: not translating MOSI & CE from RPi . If you power MC2515 from 5V then it's acceptable logic levels are higher (usually Vin(hi)_min=~3,5V (70% of Vcc)), so the mcp2515 might not catch (see) the hi logic level.
Check also quartz frequency if it's 8MHz if you have other (12M/12 = 12MHz , 16/16M = 16MHz) then correct in dtoverlay the freq too.

What say, dmesg, lsmod , "ls /sys/bus/...can...." ?

laalex
Posts: 20
Joined: Fri May 27, 2016 7:29 pm

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Sun May 29, 2016 6:52 pm

saper_2 wrote:So, you don't see/can't access can0 from ifconfig/ip ?

Looking at your circuit, I see (potential) problem: not translating MOSI & CE from RPi . If you power MC2515 from 5V then it's acceptable logic levels are higher (usually Vin(hi)_min=~3,5V (70% of Vcc)), so the mcp2515 might not catch (see) the hi logic level.
Check also quartz frequency if it's 8MHz if you have other (12M/12 = 12MHz , 16/16M = 16MHz) then correct in dtoverlay the freq too.

What say, dmesg, lsmod , "ls /sys/bus/...can...." ?

Quartz is 16MHz. It is set correct into /boot/config.txt

Commands results are:

dmesg

Code: Select all

pi@raspberrypi:~ $ dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.4.9-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #884 SMP Fri May 6 17:28:59 BST 2016
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Raspberry Pi 3 Model B Rev 1.2
[    0.000000] cma: Reserved 8 MiB at 0x3a800000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 241664
[    0.000000] free_area_init_node: node 0, pgdat 808c0d80, node_mem_map b9fa6000
[    0.000000]   Normal zone: 2124 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 241664 pages, LIFO batch:31
[    0.000000] [bcm2709_smp_init_cpus] enter (9520->f3003010)
[    0.000000] [bcm2709_smp_init_cpus] ncores=4
[    0.000000] PERCPU: Embedded 13 pages/cpu @b9f63000 s22592 r8192 d22464 u53248
[    0.000000] pcpu-alloc: s22592 r8192 d22464 u53248 alloc=13*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 239540
[    0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=640 bcm2708_fb.fbheight=480 bcm2709.boardrev=0xa02082 bcm2709.serial=0xa3eff6cd smsc95xx.macaddr=B8:27:EB:EF:F6:CD bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 939088K/966656K available (6340K kernel code, 432K rwdata, 1712K rodata, 480K init, 764K bss, 19376K reserved, 8192K cma-reserved)
[    0.000000] Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xbb800000 - 0xff800000   (1088 MB)
    lowmem  : 0x80000000 - 0xbb000000   ( 944 MB)
    modules : 0x7f000000 - 0x80000000   (  16 MB)
      .text : 0x80008000 - 0x807e5330   (8053 kB)
      .init : 0x807e6000 - 0x8085e000   ( 480 kB)
      .data : 0x8085e000 - 0x808ca088   ( 433 kB)
       .bss : 0x808cd000 - 0x8098c1ac   ( 765 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] Architected cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000010] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000027] Switching to timer-based delay loop, resolution 52ns
[    0.000296] Console: colour dummy device 80x30
[    0.001346] console [tty1] enabled
[    0.001399] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.001468] pid_max: default: 32768 minimum: 301
[    0.001802] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001845] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.002799] Disabling cpuset control group subsystem
[    0.002855] Initializing cgroup subsys io
[    0.002906] Initializing cgroup subsys memory
[    0.002967] Initializing cgroup subsys devices
[    0.003010] Initializing cgroup subsys freezer
[    0.003055] Initializing cgroup subsys net_cls
[    0.003125] CPU: Testing write buffer coherency: ok
[    0.003210] ftrace: allocating 21193 entries in 63 pages
[    0.052008] CPU0: update cpu_capacity 1024
[    0.052072] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.052104] [bcm2709_smp_prepare_cpus] enter
[    0.052247] Setting up static identity map for 0x8240 - 0x8274
[    0.053900] [bcm2709_boot_secondary] cpu:1 started (0) 18
[    0.054227] [bcm2709_secondary_init] enter cpu:1
[    0.054270] CPU1: update cpu_capacity 1024
[    0.054276] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.054658] [bcm2709_boot_secondary] cpu:2 started (0) 16
[    0.054916] [bcm2709_secondary_init] enter cpu:2
[    0.054936] CPU2: update cpu_capacity 1024
[    0.054942] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.055302] [bcm2709_boot_secondary] cpu:3 started (0) 17
[    0.055484] [bcm2709_secondary_init] enter cpu:3
[    0.055503] CPU3: update cpu_capacity 1024
[    0.055509] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.055569] Brought up 4 CPUs
[    0.055667] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.055696] CPU: All CPU(s) started in HYP mode.
[    0.055721] CPU: Virtualization extensions available.
[    0.056350] devtmpfs: initialized
[    0.066225] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[    0.066592] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.067305] pinctrl core: initialized pinctrl subsystem
[    0.067845] NET: Registered protocol family 16
[    0.073039] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[    0.080207] bcm2709: Mini UART enabled
[    0.080267] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.080313] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.080492] Serial: AMBA PL011 UART driver
[    0.080649] uart-pl011 3f201000.uart: could not find pctldev for node /soc/gpio@7e200000/uart0_pins, deferring probe
[    0.080856] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    0.142681] bcm2835-dma 3f007000.dma: DMA legacy API manager at f3007000, dmachans=0x1
[    0.144377] SCSI subsystem initialized
[    0.144573] usbcore: registered new interface driver usbfs
[    0.144683] usbcore: registered new interface driver hub
[    0.144803] usbcore: registered new device driver usb
[    0.151559] raspberrypi-firmware soc:firmware: Attached to firmware from 2016-05-06 13:53
[    0.178821] clocksource: Switched to clocksource arch_sys_counter
[    0.224165] FS-Cache: Loaded
[    0.224477] CacheFiles: Loaded
[    0.236692] NET: Registered protocol family 2
[    0.237565] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.237703] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.237913] TCP: Hash tables configured (established 8192 bind 8192)
[    0.238027] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.238095] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.238346] NET: Registered protocol family 1
[    0.238682] RPC: Registered named UNIX socket transport module.
[    0.238715] RPC: Registered udp transport module.
[    0.238742] RPC: Registered tcp transport module.
[    0.238770] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.239833] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
[    0.241230] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.254476] VFS: Disk quotas dquot_6.6.0
[    0.254806] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.257160] FS-Cache: Netfs 'nfs' registered for caching
[    0.258065] NFS: Registering the id_resolver key type
[    0.258128] Key type id_resolver registered
[    0.258157] Key type id_legacy registered
[    0.260478] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.260640] io scheduler noop registered
[    0.260678] io scheduler deadline registered (default)
[    0.260751] io scheduler cfq registered
[    0.263290] BCM2708FB: allocated DMA memory fac00000
[    0.263337] BCM2708FB: allocated DMA channel 0 @ f3007000
[    0.269007] Console: switching to colour frame buffer device 80x30
[    0.274086] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.276654] console [ttyS0] disabled
[    0.278302] 3f215040.uart: ttyS0 at MMIO 0x3f215040 (irq = 59, base_baud = 50000000) is a 16550
[    1.449481] console [ttyS0] enabled
[    2.448504] bcm2835-rng 3f104000.rng: hwrng registered
[    2.458695] vc-cma: Videocore CMA driver
[    2.466780] vc-cma: vc_cma_base      = 0x00000000
[    2.476093] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    2.486467] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    2.496986] vc-mem: phys_addr:0x00000000 mem_base=0x3dc00000 mem_size:0x3f000000(1008 MiB)
[    2.528363] brd: module loaded
[    2.543344] loop: module loaded
[    2.550821] vchiq: vchiq_init_state: slot_zero = 0xbac80000, is_master = 0
[    2.564949] Loading iSCSI transport class v2.0-870.
[    2.575082] usbcore: registered new interface driver smsc95xx
[    2.586032] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    2.797138] Core Release: 2.80a
[    2.803766] Setting default values for core params
[    2.813126] Finished setting default values for core params
[    3.024120] Using Buffer DMA mode
[    3.031073] Periodic Transfer Interrupt Enhancement - disabled
[    3.042181] Multiprocessor Interrupt Enhancement - disabled
[    3.052861] OTG VER PARAM: 0, OTG VER FLAG: 0
[    3.061543] Dedicated Tx FIFOs mode
[    3.069077] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0xbac14000 dma = 0xfac14000 len=9024
[    3.088218] FIQ FSM acceleration enabled for :
Non-periodic Split Transactions
Periodic Split Transactions
High-Speed Isochronous Endpoints
Interrupt/Control Split Transaction hack enabled
[    3.132301] dwc_otg: Microframe scheduler enabled
[    3.132352] WARN::hcd_init_fiq:413: FIQ on core 1 at 0x804459c4
[    3.143606] WARN::hcd_init_fiq:414: FIQ ASM at 0x80445d34 length 36
[    3.155392] WARN::hcd_init_fiq:439: MPHI regs_base at 0xbb932000
[    3.166774] dwc_otg 3f980000.usb: DWC OTG Controller
[    3.176453] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    3.191550] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000
[    3.202270] Init: Port Power? op_state=1
[    3.210242] Init: Power Port (0)
[    3.217218] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    3.229881] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.244793] usb usb1: Product: DWC OTG Controller
[    3.254051] usb usb1: Manufacturer: Linux 4.4.9-v7+ dwc_otg_hcd
[    3.265289] usb usb1: SerialNumber: 3f980000.usb
[    3.275160] hub 1-0:1.0: USB hub found
[    3.282860] hub 1-0:1.0: 1 port detected
[    3.291375] dwc_otg: FIQ enabled
[    3.291384] dwc_otg: NAK holdoff enabled
[    3.291392] dwc_otg: FIQ split-transaction FSM enabled
[    3.291430] Module dwc_common_port init
[    3.291683] usbcore: registered new interface driver usb-storage
[    3.303259] mousedev: PS/2 mouse device common for all mice
[    3.314568] bcm2835-cpufreq: min=600000 max=1200000
[    3.324305] sdhci: Secure Digital Host Controller Interface driver
[    3.335925] sdhci: Copyright(c) Pierre Ossman
[    3.344888] sdhost: log_buf @ bac13000 (fac13000)
[    3.428849] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    3.441636] mmc-bcm2835 3f300000.mmc: mmc_debug:0 mmc_debug2:0
[    3.452717] mmc-bcm2835 3f300000.mmc: DMA channel allocated
[    3.486059] mmc0: host does not support reading read-only switch, assuming write-enable
[    3.488918] Indeed it is in host mode hprt0 = 00021501
[    3.514211] mmc0: new high speed SDHC card at address 1234
[    3.525279] sdhci-pltfm: SDHCI platform and OF driver helper
[    3.525358] mmcblk0: mmc0:1234 SA08G 7.21 GiB
[    3.545329] ledtrig-cpu: registered to indicate activity on CPUs
[    3.553809]  mmcblk0: p1 p2 < p5 p6 p7 >
[    3.564893] hidraw: raw HID events driver (C) Jiri Kosina
[    3.572687] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    3.574233] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    3.575783] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    3.578584] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    3.617359] usbcore: registered new interface driver usbhid
[    3.627914] usbhid: USB HID core driver
[    3.636266] Initializing XFRM netlink socket
[    3.644726] NET: Registered protocol family 17
[    3.653536] Key type dns_resolver registered
[    3.662416] Registering SWP/SWPB emulation handler
[    3.669424] mmc1: new high speed SDIO card at address 0001
[    3.678852] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    3.678980] Indeed it is in host mode hprt0 = 00001101
[    3.704516] registered taskstats version 1
[    3.712839] vc-sm: Videocore shared memory driver
[    3.721984] [vc_sm_connected_init]: start
[    3.730411] [vc_sm_connected_init]: end - returning 0
[    3.741333] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[    3.758731] of_cfs_init
[    3.764229] of_cfs_init: OK
[    3.773419] EXT4-fs (mmcblk0p7): INFO: recovery required on readonly filesystem
[    3.788062] EXT4-fs (mmcblk0p7): write access will be enabled during recovery
[    3.879122] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    3.891532] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.905434] hub 1-1:1.0: USB hub found
[    3.913172] hub 1-1:1.0: 5 ports detected
[    4.198847] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    4.309077] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    4.321894] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    4.339723] smsc95xx v1.0.4
[    4.402102] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:ef:f6:cd
[    8.169851] EXT4-fs (mmcblk0p7): recovery complete
[    8.186281] EXT4-fs (mmcblk0p7): mounted filesystem with ordered data mode. Opts: (null)
[    8.202809] VFS: Mounted root (ext4 filesystem) readonly on device 179:7.
[    8.224176] devtmpfs: mounted
[    8.231486] Freeing unused kernel memory: 480K (807e6000 - 8085e000)
[    8.533611] random: systemd urandom read with 79 bits of entropy available
[    8.550494] systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
[    8.576174] systemd[1]: Detected architecture 'arm'.
[    8.690189] NET: Registered protocol family 10
[    8.700655] systemd[1]: Inserted module 'ipv6'
[    8.713054] systemd[1]: Set hostname to <raspberrypi>.
[    9.153483] systemd[1]: Expecting device dev-ttyS0.device...
[    9.167020] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
[    9.183367] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    9.199481] systemd[1]: Starting Remote File Systems (Pre).
[    9.212726] systemd[1]: Reached target Remote File Systems (Pre).
[    9.224720] systemd[1]: Starting Arbitrary Executable File Formats File System Automount Point.
[    9.245414] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[    9.264663] systemd[1]: Starting Encrypted Volumes.
[    9.276796] systemd[1]: Reached target Encrypted Volumes.
[    9.287579] systemd[1]: Starting Swap.
[    9.297694] systemd[1]: Reached target Swap.
[    9.306567] systemd[1]: Expecting device dev-mmcblk0p6.device...
[    9.320440] systemd[1]: Starting Root Slice.
[    9.331546] systemd[1]: Created slice Root Slice.
[    9.341169] systemd[1]: Starting User and Session Slice.
[    9.354058] systemd[1]: Created slice User and Session Slice.
[    9.365335] systemd[1]: Starting /dev/initctl Compatibility Named Pipe.
[    9.380269] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[    9.393507] systemd[1]: Starting Delayed Shutdown Socket.
[    9.406338] systemd[1]: Listening on Delayed Shutdown Socket.
[    9.417577] systemd[1]: Starting Journal Socket (/dev/log).
[    9.430671] systemd[1]: Listening on Journal Socket (/dev/log).
[    9.442139] systemd[1]: Starting udev Control Socket.
[    9.454171] systemd[1]: Listening on udev Control Socket.
[    9.464761] systemd[1]: Starting udev Kernel Socket.
[    9.476592] systemd[1]: Listening on udev Kernel Socket.
[    9.487075] systemd[1]: Starting Journal Socket.
[    9.498535] systemd[1]: Listening on Journal Socket.
[    9.508473] systemd[1]: Starting System Slice.
[    9.519646] systemd[1]: Created slice System Slice.
[    9.529403] systemd[1]: Starting File System Check on Root Device...
[    9.569424] systemd[1]: Starting system-systemd\x2dfsck.slice.
[    9.583354] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[    9.595524] systemd[1]: Starting system-autologin.slice.
[    9.608985] systemd[1]: Created slice system-autologin.slice.
[    9.620235] systemd[1]: Starting system-serial\x2dgetty.slice.
[    9.634001] systemd[1]: Created slice system-serial\x2dgetty.slice.
[    9.646160] systemd[1]: Starting Increase datagram queue length...
[    9.709616] systemd[1]: Starting Restore / save the current clock...
[    9.730902] systemd[1]: Mounting Debug File System...
[    9.745859] systemd[1]: Mounted Huge Pages File System.
[    9.756617] systemd[1]: Starting udev Coldplug all Devices...
[    9.826924] systemd[1]: Starting Load Kernel Modules...
[    9.898171] systemd[1]: Started Set Up Additional Binary Formats.
[    9.915439] systemd[1]: Starting Create list of required static device nodes for the current kernel...
[    9.940829] systemd[1]: Mounting POSIX Message Queue File System...
[    9.958074] systemd[1]: Starting Slices.
[    9.969435] systemd[1]: Reached target Slices.
[    9.983324] systemd[1]: Mounted POSIX Message Queue File System.
[    9.997736] systemd[1]: Mounted Debug File System.
[    9.999741] fuse init (API version 7.23)
[   10.019512] systemd[1]: Started File System Check on Root Device.
[   10.019884] i2c /dev entries driver
[   10.043020] can: controller area network core (rev 20120528 abi 9)
[   10.055065] NET: Registered protocol family 29
[   10.065084] can: raw protocol (rev 20120528)
[   10.075195] systemd[1]: Started Increase datagram queue length.
[   10.090285] systemd[1]: Started Restore / save the current clock.
[   10.106391] vcan: Virtual CAN interface driver
[   10.119285] CAN device driver interface
[   10.140539] systemd[1]: systemd-modules-load.service: main process exited, code=exited, status=1/FAILURE
[   10.165276] systemd[1]: Failed to start Load Kernel Modules.
[   10.176379] systemd[1]: Unit systemd-modules-load.service entered failed state.
[   10.195246] systemd[1]: Started Create list of required static device nodes for the current kernel.
[   10.217404] systemd[1]: Started udev Coldplug all Devices.
[   10.231596] systemd[1]: Time has been changed
[   10.384418] systemd[1]: Starting Create Static Device Nodes in /dev...
[   10.449492] systemd[1]: Mounting FUSE Control File System...
[   10.465570] systemd[1]: Starting Apply Kernel Variables...
[   10.482413] systemd[1]: Mounting Configuration File System...
[   10.499005] systemd[1]: Starting Syslog Socket.
[   10.511713] systemd[1]: Listening on Syslog Socket.
[   10.521970] systemd[1]: Starting Journal Service...
[   10.539823] systemd[1]: Started Journal Service.
[   10.719030] systemd-udevd[136]: starting version 215
[   11.096470] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
[   11.114166] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[   11.400066] EXT4-fs (mmcblk0p7): re-mounted. Opts: (null)
[   11.487347] brcmfmac: brcmf_sdio_drivestrengthinit: No SDIO Drive strength init done for chip 43430 rev 1 pmurev 24
[   11.487950] usbcore: registered new interface driver brcmfmac
[   11.690146] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Dec 15 2015 18:10:45 version 7.45.41.23 (r606571) FWID 01-cc4eda9c
[   11.698293] random: nonblocking pool is initialized
[   11.711604] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
[   11.922161] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
[   11.922186] cfg80211: World regulatory domain updated:
[   11.922196] cfg80211:  DFS Master region: unset
[   11.922204] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   11.922218] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   11.922231] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   11.922243] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[   11.922257] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   11.922271] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[   11.922284] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   11.922296] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[   11.922308] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[   12.247372] systemd-journald[133]: Received request to flush runtime journal from PID 1
[   12.712863] brcmfmac: brcmf_add_if: ERROR: netdev:wlan0 already exists
[   12.712883] brcmfmac: brcmf_add_if: ignore IF event
[   12.717702] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   12.717749] brcmfmac: power management disabled
[   12.838920] uart-pl011 3f201000.uart: no DMA platform data
[   13.163595] Adding 102396k swap on /var/swap.  Priority:-1 extents:1 across:102396k SSFS
[   13.290279] cfg80211: Regulatory domain changed to country: GB
[   13.290294] cfg80211:  DFS Master region: ETSI
[   13.290299] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   13.290307] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   13.290315] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   13.290322] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[   13.290329] cfg80211:   (5490000 KHz - 5710000 KHz @ 160000 KHz), (N/A, 2700 mBm), (0 s)
[   13.290335] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[   13.590008] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[   13.590138] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   14.540596] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   17.228326] Bluetooth: Core ver 2.21
[   17.228410] NET: Registered protocol family 31
[   17.228421] Bluetooth: HCI device and connection manager initialized
[   17.228443] Bluetooth: HCI socket layer initialized
[   17.228461] Bluetooth: L2CAP socket layer initialized
[   17.228496] Bluetooth: SCO socket layer initialized
[   17.238509] Bluetooth: HCI UART driver ver 2.3
[   17.238530] Bluetooth: HCI UART protocol H4 registered
[   17.238539] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   17.238715] Bluetooth: HCI UART protocol BCM registered
[   17.400772] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   17.400784] Bluetooth: BNEP filters: protocol multicast
[   17.400798] Bluetooth: BNEP socket layer initialized
lsmod:

Code: Select all

pi@raspberrypi:~ $ lsmod
Module                  Size  Used by
bnep                   10340  2
hci_uart               17943  1
btbcm                   5929  1 hci_uart
bluetooth             326105  22 bnep,btbcm,hci_uart
brcmfmac              186599  0
brcmutil                5661  1 brcmfmac
cfg80211              427855  1 brcmfmac
rfkill                 16037  4 cfg80211,bluetooth
snd_bcm2835            20511  0
snd_pcm                75698  1 snd_bcm2835
snd_timer              19160  1 snd_pcm
snd                    51844  3 snd_bcm2835,snd_timer,snd_pcm
bcm2835_gpiomem         3040  0
spi_bcm2835             7286  0
bcm2835_wdt             3225  0
uio_pdrv_genirq         3164  0
uio                     8000  1 uio_pdrv_genirq
mcp251x                 8502  0
can_dev                 9561  1 mcp251x
vcan                    2065  0
can_raw                 6852  0
can                    27068  1 can_raw
i2c_dev                 5859  0
fuse                   83461  1
ipv6                  347530  30
ls command:

Code: Select all

pi@raspberrypi:~ $ ls /sys/bus
amba  clockevents  clocksource  container  cpu  event_source  hid  i2c  iscsi_flashnode  mmc  platform  scsi  sdio  spi  usb  workqueue
pi@raspberrypi:~ $ ls /sys/bus/spi/
devices  drivers  drivers_autoprobe  drivers_probe  uevent
pi@raspberrypi:~ $ ls /sys/bus/spi/devices
spi0.0  spi0.1
pi@raspberrypi:~ $ ls /sys/bus/spi/devices/spi0.0/
modalias  of_node  power  statistics  subsystem  uevent

laalex
Posts: 20
Joined: Fri May 27, 2016 7:29 pm

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Sun May 29, 2016 7:04 pm

I have another question also, where should the shield reset pin be hooked up with the Raspberry PI?

User avatar
saper_2
Posts: 214
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Sun May 29, 2016 7:04 pm

ugh... scrolling through dmesg is pain in neck (for future try using grep to "filter out" lines :) )
I don't see a mcp2515 being mentioned as registered can interface. Only virtual can (vcan)...
Check if you have "net" sub-dir in spi0.1 device (I don't see it in 0.0):

Code: Select all

ls /sys/bus/spi/devices/spi0.1/
If not then this must be hw problem or something on Pi3 might disrupting spi & mcp2515 kernel module... I'll test my can module on pi3 later...

And, I remember seeing (few topics ago ;) ) that someone had problem with floating reset pin of mcp2515 from arduino shield (RST should be tied to the MCP2515 vcc).

laalex
Posts: 20
Joined: Fri May 27, 2016 7:29 pm

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Sun May 29, 2016 7:14 pm

I'll try to hook up the reset pin to mcp2515 vcc.

Also, just to check: the arduino pins are tied into the LLC to the HV and the raspberry pi pins are wirde to the LV on the LLC side. The HV is 5V from raspberry and LV is 3.3 from raspberry. Shield GND is wired to Raspberry GND. Is this correct?

Edit: running

Code: Select all

ls /sys/bus/spi/devices/spi0.1/
doesn't show the "net" subdir as well.

laalex
Posts: 20
Joined: Fri May 27, 2016 7:29 pm

Re: [quick-guide] CAN bus on raspberry pi with MCP2515

Sun May 29, 2016 7:23 pm

Also this seems to be odd: If I run dmesg and search for mcp or spi I get nothing in return:

Code: Select all

pi@raspberrypi:~ $ dmesg | grep mcp
pi@raspberrypi:~ $ dmesg | grep spi
Shouldn't I at least get something for SPI?

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 12 guests