Hello everyone!
I recently purchased a brand new RaspberryPi 3 Model B+ for my internship project.
The goal is to establish a CAN connection beetween the microcontroller and a device
(which is a battery but it isn't the purpose of my post).
For that i also ordered the Pican2 board from the skpgang website:
skpang.co.uk/catalog/pican2-canbus-board-for-raspberry-pi-2-p-1475.html
Now, i followed every tutorial available on the site, and the "easy to install driver thing" simply won't work.
The Pi can't send any frame. I don't know what to do so far, and i'm blocked since 2 weeks and I can't find the problem.
Any help/suggestion/support would be gladly appreciated.
Now here is the detail of everything i've done so far:
-First of all, I installed the latest Rasbian downloaded from the Raspberry site. I've not encountered any problems formatting my SD card and writing the image. The Rpi boots
normally, i have a HDMI monitor connected to it directly and also a keyboard and a mouse. The first thing i do after configuring the boot is
Code: Select all
sudo apt-get update
sudo apt-get upgrade
in order to have the latest updates. The uname -a command returns me
Linux raspberrypi 4.1.19-v7+
-After a reboot, i added the last 3 lines in config.txt as stated in the tutorial to enable spi and the overlays of mcp-2515 and bcm2835 drivers.
Code: Select all
dtparam=spi=on
dtoverlay=mcp-2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835-overlay
-Again, i reboot, and i bring up the can interface with this command:
Code: Select all
sudo /sbin/ip link set can0 up type can bitrate 250000
I use 250 baudrate because the battery uses that transfering speed. But it's not important at the moment. The command ifconfig can0 returns me the can0 connection
-Now, for installing can-utils I used different methods:
the result is exactly the same and i can't figure out why. I did a reset of the Rasbian Jessie for each method and
the result is still the same.
1st method
Code: Select all
sudo apt-get install can-utils
sudo reboot
2nd method
As in the tutorial at
http://skpang.co.uk/blog/archives/1165
I did:
Code: Select all
sudo wget http://www.skpang.co.uk/dl/can-test_pi2.zip
unzip can-test_pi2.zip
cd can-test_pi2.zip
for executing the programs as cansend, candump
3rd method
http://elinux.org/Can-utils
I followed exactly what's evoked on the tutorial.
I installed these packages first, because the compiling of the can-utils gave me some errors:
Code: Select all
sudo aptitude install automake autoconf
sudo aptitude install libtool
Now the thing is: whenever i try to use the cansend command, it executes fine.
However,
should send on can0 this frame.
The command it executes.
When i try to use candump can0, the console stays on hold until i'm obliged to ctrl^C
This is the output after sending my frame (the output is exactly the same after accomplishing all the methods)
I don't know what to do so far, i followed every step and it should work but it doesn't..
Is it because it is a RaPi3 and not 2 ?
Strange because the GPIO ports are exactly the same between the 2 models.
I tried also using wireshard to record any incoming input. I used a Usb Pcan connected directly to the 4 way screw terminal
With the software installed on the pc Pcan View i tried sending a frame every 1000ms but the device doesn't record any input.
I noticed there is a LED on the right side of the 4way screw terminal, near the R8 resistance. It's always off, i'm asking myself if there is a connectivity problems between the Can module and the Pi (strange because when i try to bring the can0 interface up, it recognises my device .. )
Thank you in advance for considering helping me.
Filip
EDIT:
Okay , so finnally i discovered what was wrong all this time: if you want to use the Raspberry Pi with an external device, you
MUST enable the terminator resistor to avoid reflections/perturbation of the signal. Once you enabled it just follow the steps and it will work