abburi
Posts: 2
Joined: Wed Feb 22, 2017 11:35 am

Re: CAN controller

Wed Feb 22, 2017 11:47 am

hello all,
i have issue while doing ./cantest
write :non buffer space avilable.
http://skpang.co.uk/blog/archives/1165 by following this link i have done all steps.

User avatar
PeterO
Posts: 4876
Joined: Sun Jul 22, 2012 4:14 pm

Re: CAN controller

Wed Feb 22, 2017 1:20 pm

It suggests you are sending CAN messages but no other CANBUS nodes are acknowledging them. What other CAN devices do you have connected ? What address are you using with cantest ?

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Alkesh1410
Posts: 1
Joined: Wed Apr 05, 2017 10:14 am

Re: CAN controller

Wed Apr 05, 2017 10:20 am

Hello,
I have booted my PI3 with Android-N, Can anyone help me install the supporting libraries required for establishing the connection between CAN-Module(MCP2515) and PI3.

abburi
Posts: 2
Joined: Wed Feb 22, 2017 11:35 am

Re: CAN controller

Thu Jul 20, 2017 9:53 am

Hallo ,
I have a pican and a raspberry pi2 model b .I configured can0 using skpang website insturctions.Can0 device is available and i am not getting any messages in candump can anyone help me please.

vnrgoli
Posts: 15
Joined: Sat Apr 01, 2017 7:57 pm

Re: CAN controller

Sun Jul 23, 2017 1:13 am

I am also having same issue raspi3 <---> pican.

Getting candump messages but response value has empty packets.

Code: Select all

pi@raspberrypi:~ $ candump can1
  can1  7DF   [8]  02 01 0C 00 00 00 00 00
Any suggestions?

jeremie
Posts: 1
Joined: Fri Dec 01, 2017 10:18 am

Re: CAN controller

Fri Dec 01, 2017 4:54 pm

I am tryling to use a PiCan2 on Rpi3 with ubuntu 16.04 server 4.4.0-1009-raspi2 and added in /boot/firmare/config.txt the following lines:

Code: Select all

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835
Unfortunately, trying to set can up fails:

Code: Select all

sudo ip link set can0 type can bitrate 125000
Cannot find device "can0"
I do not see anything wrong in dmesg and lsmod show:

Code: Select all

Module                  Size  Used by
binfmt_misc            20480  1
brcmfmac              282624  0
brcmutil               20480  1 brcmfmac
cfg80211              548864  1 brcmfmac
spi_bcm2835            20480  0
bcm2835_gpiomem        16384  0
i2c_bcm2708            16384  0
uio_pdrv_genirq        16384  0
uio                    20480  1 uio_pdrv_genirq
iscsi_tcp              20480  0
libiscsi_tcp           24576  1 iscsi_tcp
libiscsi               53248  2 libiscsi_tcp,iscsi_tcp
mcp251x                20480  0
can_bcm                24576  0
can_raw                20480  0
can_dev                24576  1 mcp251x
can                    40960  2 can_bcm,can_raw
btrfs                1208320  0
raid10                 61440  0
raid456               126976  0
async_raid6_recov      20480  1 raid456
async_memcpy           16384  2 raid456,async_raid6_recov
async_pq               16384  2 raid456,async_raid6_recov
async_xor              16384  3 async_pq,raid456,async_raid6_recov
async_tx               16384  5 async_pq,raid456,async_xor,async_memcpy,async_raid6_recov
xor                    16384  2 btrfs,async_xor
xor_neon               16384  1 xor
raid6_pq              106496  4 async_pq,raid456,btrfs,async_raid6_recov
raid1                  45056  0
raid0                  20480  0
linear                 16384  0
Any help would be appreciate

irobles
Posts: 1
Joined: Thu Dec 21, 2017 3:21 pm

Re: CAN controller

Thu Dec 21, 2017 4:11 pm

Hi,

I have a pican2 duo board and a raspi3. Everything works well, but now I want to cancel some messages based on canId or data values. I'm modifying the mcp251x driver but I don't know how to send an error active.

An error active can be sent from mcp251x driver? Or I have to modify another driver?

Thanks in advance.

Igor

peetereczek
Posts: 1
Joined: Sun May 20, 2018 9:09 pm

Re: RPi3 with Pican2 Problems

Sun May 20, 2018 9:12 pm

Hello,

It seems I have same issue like 1bonp wrote below. He mentioned to use build in resistor, but could you explain me shortly how can i do that? Maybe anyone has photo of that?

Greetings,
Piotr
1bonp wrote:
Thu May 12, 2016 9:44 am
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,

Code: Select all

 cansend can0 123#13371337 
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)

Image
Image

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.

Image

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

odenizot
Posts: 1
Joined: Fri Jul 29, 2016 5:37 pm

Re: CAN controller

Thu May 31, 2018 12:18 pm

Hello All.

I use a RPi 3B+ with a PiCAN2 Duo card. I'm also running Raspbian v4.14.43-v7 + (same problem with v4.14.34). I use the downloaded version on the site rapsberrypi.org without then with updates.

Here is the problem : I want to send frames in the void on the bus, and for this to work, I must add the options presume-ack and / or one-shot in the command ip, except that the system answers me RTNETLINK answers: Operation not supported for any of this commands. In the binary ip file, the optionspresume-ack and one-shot exist.

Here are the configuration files:
End of the file /boot/config.txt :

Code: Select all

dtoverlay=mcp2515-can1,oscillator=16000000,interrupt=24
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi0-hw-cs

File /etc/network/interfaces.d/can :

Code: Select all

auto can0
iface can0 inet manual
  pre-up ip link set $IFACE type can bitrate 250000 listen-only off presume-ack on one-shot on
  up /sbin/ifconfig $IFACE up
  down /sbin/ifconfig $IFACE down
  
auto can1
iface can1 inet manual
  pre-up ip link set $IFACE type can bitrate 250000 listen-only off presume-ack on one-shot on
  up /sbin/ifconfig $IFACE up
  down /sbin/ifconfig $IFACE down

I noticed that for CANA and CANB ports to correspond to can0 and can1 respectively, you must declare in the /boot/config.txt file in the reverse order (can1 then can0).

Thanks in advance for your help.

Olivier.

rhnelson
Posts: 1
Joined: Fri Jun 08, 2018 5:24 pm

Re: CAN controller

Fri Jun 08, 2018 6:11 pm

Hello,

Also trying to get the one-shot option to work. I'm using a Pi 2B with latest Raspbian 4.14.34-v7 (yours says 43-v7 mine is 34-v7 ???).
My interface is a MCP2551/1050 which I believe is similar to yours but only one Can Bus link.

My setup commands are -
In the /boot/config.txt
dtoverlay=mcp2551-can0,oscillator=8000000,interrupt=12
dtoverlay=bcm2835-overlay
From command line:
sudo ip link set can0 up type can bitrate 500000 ----> no error
sudo ip link set can0 up type can bitrate 500000 one-shot on ----> RTNETLINK answers: Operation not supported

One interesting fact is that the above no error "ip" WILL give the same issue if I do not use sudo.

Were you able to find out how to configure and use the one-shot config option?

Thanks for any help
Randy

odenizot wrote:
Thu May 31, 2018 12:18 pm
Hello All.

I use a RPi 3B+ with a PiCAN2 Duo card. I'm also running Raspbian v4.14.43-v7 + (same problem with v4.14.34). I use the downloaded version on the site rapsberrypi.org without then with updates.

Here is the problem : I want to send frames in the void on the bus, and for this to work, I must add the options presume-ack and / or one-shot in the command ip, except that the system answers me RTNETLINK answers: Operation not supported for any of this commands. In the binary ip file, the optionspresume-ack and one-shot exist.

...

Thanks in advance for your help.

Olivier.

hrdwrbob
Posts: 1
Joined: Sat Jun 09, 2018 1:59 pm

Re: CAN controller

Sat Jun 09, 2018 2:01 pm

Hey guys,
I'm trying to make an MCP2515 CAN board work over SPI with my raspberry pi.

Wiring harness:
https://github.com/hrdwrbob/eingauge/bl ... pin-output

Trace cut on board and 5V line run to CAN transciever - confirmed with multimeter that it's 5V, and that Vcc is 3.3V.
https://i.imgur.com/1eVwugN.jpg
(as per viewtopic.php?t=141052)

Setup on raspberry pi:
in /boot/config:

Code: Select all

dtoverlay=mcp2515-can1,oscillator=16000000,interrupt=12
dmesg output:

Code: Select all

[   16.928281] mcp251x spi0.1 can0: MCP2515 successfully initialized.
on command line (50kHz CAN is subaru high speed, same as arduino)

Code: Select all

sudo ip link set can0 up type can bitrate 50000

root@raspberrypi:/home/pi# ip -s -d link show can0
3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0
    can state ERROR-ACTIVE restart-ms 0
      bitrate 50000 sample-point 0.875
      tq 1250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
      mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
      clock 8000000
      re-started bus-errors arbit-lost error-warn error-pass bus-off
      0          0          0          0          0          0         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
    RX: bytes  packets  errors  dropped overrun mcast
    0          0        0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    0          0        0       0       0       0
run candump/cansniffer

Tested in car - nothing seen on CAN.

Arduino CAN setup is known working - Removed from car, jumpered to terminate canbus at each end and directly connected, arduino is generating can messages. (much easier not in the car)
https://i.imgur.com/8CcCVnU.jpg

I can't see what's wrong here - I can fall back to serial in the short term, but I really need to use CAN for this to work properly.

Any ideas?

tlab
Posts: 1
Joined: Fri Jun 22, 2018 1:33 am

Re: CAN controller

Fri Jun 22, 2018 1:41 am

Hey hrdwrbob,

Have you checked out the schematic for this:
http://copperhilltech.com/pican-2-can-i ... ry-pi-2-3/

I have one and it works, the full schematic seems to be there.

I'm going to try and recreate this on a smaller board for Pi Zero W.

I've also got a subaru I'm working on creating a datalogger, tracker, possibly more with. Let me know if you want to swap CAN data. I'm still trying to decode some things on the high speed. I haven't gotten to the low speed yet.

Travis

floflo530
Posts: 1
Joined: Tue Mar 26, 2019 4:20 pm

Re: CAN controller

Tue Mar 26, 2019 4:22 pm

geesamba wrote:
Fri Mar 06, 2015 12:09 am
I've got a Pi Model B running 3.12.28+ with the mcp251x modules from here: http://www.cowfishstudios.com/blog/canned-pi-part1 using the PICAN from here: http://skpang.co.uk/catalog/pican-canbu ... -1196.html. I have two wires (high going to pin 6 and low going to 14) just like the cowfish tutorial going into the PICAN.

I'm trying to listen to CAN bus messages via the obd2 port on my 2011 Audi Q5. I have can0 up and I've tried all the bitrates, but I see no messages with candump/cansniffer. The stats on the can0 interface don't even budge from 0.

Is there a technical reason that those messages don't show up on that port? I own a VAG-COM wireless unit, so I know the port works and can "see" things and pull codes.

Any ideas from a VW/Audi user?

Thanks in advance.
hi i have this problem too with audi Q3 2013 do you have resolved it ?

skpang
Posts: 19
Joined: Mon Jul 29, 2013 10:09 pm
Location: Essex, UK
Contact: Website

Re: CAN controller

Wed Mar 27, 2019 9:04 am

VAG-COM works because it is doing a request then the car does a reply.

When you use candump it is only listening, there is no request.

The OBDII port is not a direct connection to the CAN network, it is via a gateway. The gateway isolate you from the internal network, that is why you don't see any messages by just listening.

You need to do a request using cansend and watch the reply with candump.

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