Re: CAN controller
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.
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.
Re: CAN controller
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
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PICO,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
Interests: C,Python,PICO,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
-
- Posts: 1
- Joined: Wed Apr 05, 2017 10:14 am
Re: CAN controller
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.
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.
Re: CAN controller
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.
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.
Re: CAN controller
I am also having same issue raspi3 <---> pican.
Getting candump messages but response value has empty packets.
Any suggestions?
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
Re: CAN controller
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:
Unfortunately, trying to set can up fails:
I do not see anything wrong in dmesg and lsmod show:
Any help would be appreciate
Code: Select all
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835
Code: Select all
sudo ip link set can0 type can bitrate 125000
Cannot find device "can0"
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
Re: CAN controller
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
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
-
- Posts: 4
- Joined: Sun May 20, 2018 9:09 pm
Re: RPi3 with Pican2 Problems
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
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 amHello 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 isin order to have the latest updates. The uname -a command returns meCode: Select all
sudo apt-get update sudo apt-get upgrade
-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.Linux raspberrypi 4.1.19-v7+-Again, i reboot, and i bring up the can interface with this command:Code: Select all
dtparam=spi=on dtoverlay=mcp-2515-can0,oscillator=16000000,interrupt=25 dtoverlay=spi-bcm2835-overlay
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 connectionCode: Select all
sudo /sbin/ip link set can0 up type can bitrate 250000
-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
2nd methodCode: Select all
sudo apt-get install can-utils sudo reboot
As in the tutorial at
http://skpang.co.uk/blog/archives/1165
I did:for executing the programs as cansend, candumpCode: Select all
sudo wget http://www.skpang.co.uk/dl/can-test_pi2.zip unzip can-test_pi2.zip cd can-test_pi2.zip
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.Code: Select all
cansend can0 123#13371337
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
Re: CAN controller
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 :
File /etc/network/interfaces.d/can :
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.
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.
Re: CAN controller
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
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 pmHello 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.
Re: CAN controller
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:
dmesg output:
on command line (50kHz CAN is subaru high speed, same as arduino)
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?
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
Code: Select all
[ 16.928281] mcp251x spi0.1 can0: MCP2515 successfully initialized.
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
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?
Re: CAN controller
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
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
Re: CAN controller
hi i have this problem too with audi Q3 2013 do you have resolved it ?geesamba wrote: ↑Fri Mar 06, 2015 12:09 amI'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.
Re: CAN controller
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.
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.
Re: CAN controller
Good day people.
The question is ...
There is a Raspberry Pi Model B. Linux version raspberrypi 4.19.66+ # 1253 Thu Aug 15 11:37:30 BST 2019 armv6l GNU / Linux. CAN module mcp2515.
After installation, the instructions almost worked. But after the team
the processor is 100% loaded. by SPI permanent packages. Shouldn't he pass data on the cansend command? And to accept by interruption on a pin?
The question is ...
There is a Raspberry Pi Model B. Linux version raspberrypi 4.19.66+ # 1253 Thu Aug 15 11:37:30 BST 2019 armv6l GNU / Linux. CAN module mcp2515.
After installation, the instructions almost worked. But after the team
Code: Select all
ip link set can0 up type can bitrate 500000
Re: CAN controller
Apart from MCP25XX chip, there is another easy and cheap way to interface the Rpi with a CAN controller. Just use an MCU with CAN peripheral module.
If you get one dollar STM32F103 you don't have to write firmware and kernel drivers. You can control MCU's CAN peripheral as if the peripheral was a part of Raspberry Pi Chip.
Unlike highly specialized MCP25XX chip, STM32 MCU provides a wide list of extra low-level peripherals such as ADC, DAC, Timers etc
Detailed youtube video: https://youtu.be/JdBabbC5Prk
Github repo: https://github.com/remotemcu/remcu_exam ... 32F103RCT6
If you get one dollar STM32F103 you don't have to write firmware and kernel drivers. You can control MCU's CAN peripheral as if the peripheral was a part of Raspberry Pi Chip.
Unlike highly specialized MCP25XX chip, STM32 MCU provides a wide list of extra low-level peripherals such as ADC, DAC, Timers etc
Detailed youtube video: https://youtu.be/JdBabbC5Prk
Github repo: https://github.com/remotemcu/remcu_exam ... 32F103RCT6
Re: CAN controller
Hi guys.
One quick question.
Im trying to push mcp251x to work on 1mbps. I tried to apply rt patch and see improvements.
But unfortunetly (using cangen and candump), i have buffer overflows all the time
Is rt patch even suitable for this use?
Thanks.
One quick question.
Im trying to push mcp251x to work on 1mbps. I tried to apply rt patch and see improvements.
But unfortunetly (using cangen and candump), i have buffer overflows all the time
Is rt patch even suitable for this use?
Thanks.
Re: CAN controller
Hi,
I've the same problem! Do you have a solution?
There is a patch for hardware filtering, in the case you don't need all frame. See https://github.com/craigpeacock/mcp251x
Or move to the MCP2518FD ? It seems too have much more receive buffers!
Re: CAN controller
Hello,
for use the implementation in kernel 5.12-rc8 worked well. How wants to test:
https://github.com/pyavitz/rpi-img-buil ... -23.img.xz
for use the implementation in kernel 5.12-rc8 worked well. How wants to test:
https://github.com/pyavitz/rpi-img-buil ... -23.img.xz
Last edited by KMK0815 on Mon Apr 26, 2021 12:37 pm, edited 2 times in total.
Re: CAN controller
Hello ,
I hope you consult until today this topic .
I have a several problem which i couldn't solve it .
So ,I am using RPi 3 with Raspbian distribution ,socketCAN driver and PICAN2 board connected to a Motor control board .
I set the can0 up by this command :
sudo /sbin/ip link set can0 up type can bitrate 1000000 .
When i send a CAN frame using cansend can0 it works fine , i receive the frame sent in my control board .
The control board send a response frame to pican2 .
My problem is that candump can0 did not receive the response frame .
Currently I have 2 terminal , 1 for sending and 1 for receiving .
what’s wrong !!! I can’t find the problem .
I appreciate any suggestion
Thank you
I hope you consult until today this topic .
I have a several problem which i couldn't solve it .
So ,I am using RPi 3 with Raspbian distribution ,socketCAN driver and PICAN2 board connected to a Motor control board .
I set the can0 up by this command :
sudo /sbin/ip link set can0 up type can bitrate 1000000 .
When i send a CAN frame using cansend can0 it works fine , i receive the frame sent in my control board .
The control board send a response frame to pican2 .
My problem is that candump can0 did not receive the response frame .
Currently I have 2 terminal , 1 for sending and 1 for receiving .
what’s wrong !!! I can’t find the problem .
I appreciate any suggestion
Thank you