Hi cadsenthilkumar,
I did check the method and didn't find any problem.
I changed the crystal to 8Mhz and everything was ok.
Maybe the best way to check is to use two MCP2515 on the raspberry pi and see if you can send from one to the other.
On the First MCP2515 I use the schematic from this site.
http://skpang.co.uk/catalog/pican-canbu ... -1196.html
And for the second MCP2515 I use CE1 instead of CE0 and GPIO24 instead of GPIO25
I add the second device into the /etc/modules
Code: Select all
root@RpiTest:~# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
snd-bcm2835
# MCP2515 configuration w[code]
ith /INT on GPIO25 and 16MHz clock
spi-config devices=\
bus=0:cs=0:modalias=mcp2515:speed=10000000:gpioirq=25:pd=20:pds32-0=16000000:pdu32-4=0x2002:force_release,bus=0:cs=1:modalias=mcp2515:speed=10000000:gpioirq=24:pd=20:pds32-0=8000000:pdu32-4=0x2002:force_release
#and of course the mcp2515 driver
mcp2515
root@RpiTest:~#[/code]
B.T.W. The second MCP2515 run with a 8Mhz crystal.
and into /etc/network/interfaces
Code: Select all
root@RpiTest:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback
#iface eth0 inet dhcp
allow-hotplug wlan0
#iface wlan0 inet manual
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#pre-up ifdown eth0; echo -n '1-1.1:1.0' >/sys/bus/usb/drivers/smsc95xx/unbind
#post-down echo -n '1-1.1:1.0' >/sys/bus/usb/drivers/smsc95xx/bind
iface default inet dhcp
auto can0
iface can0 inet manual
pre-up /sbin/ip link set can0 type can bitrate 125000
up /sbin/ifconfig can0 up
down /sbin/ifconfig can0 down
auto can1
iface can1 inet manual
pre-up /sbin/ip link set can1 type can bitrate 125000
up /sbin/ifconfig can1 up
down /sbin/ifconfig can1 down
root@RpiTest:~#
I open 2 ssh consoles
On the first one I type
On the second console I type
Code: Select all
root@RpiTest:~# cansend can1 7ef#0101050000000000
And I got a respond on the first console
Code: Select all
can0 7EF [8] 01 01 05 00 00 00 00 00
This is a neat trick to check if the canbus is working on the Rpi side.
Daniel