david_1234
Posts: 51
Joined: Mon Jan 01, 2018 2:14 pm

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

Mon Jan 01, 2018 4:21 pm

I did everything like it say in the guide

but I don't get the can interface
any idea why ?

I havetry 2-3 times - I get no error in any step ,
but I don't have "can" interface.

The mcp2515 is connected as shown in the setup

I'm using raspberry pi 2 Model B - Jessie 4.9.35-V7

waht am I doing wrong ?


Thanks ,

david_1234
Posts: 51
Joined: Mon Jan 01, 2018 2:14 pm

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

Mon Jan 01, 2018 5:27 pm

don't know what I did - but I reinstall everything and now it's working :-)


now I want to do this :
run a pyton code that take the data and solve it as a simple massage
for example:
when I get 18FE320 - I will decode it as "door open"

how can I do this ?

Thanks ,

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

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

Thu Jan 04, 2018 12:21 pm

david_1234 - for reinstalling, something u must have broken/not installed.

As for what u want, ask uncle google: https://goo.gl/e7NZmB .

Stafan Willms
Posts: 1
Joined: Sat Feb 17, 2018 12:59 pm

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

Sat Feb 17, 2018 1:18 pm

Hi,

thanks to this nice quick-guide i managed to access the CAN bus of my heating system at home with my pi. I can send requests with the "cansend" command and search for the response with the "candump" command. But this searching for the response is pain in the ass, and for my project i am serching for an way to get the direct response to my specific request automatic. Does anybody know if there is an command that i can use, that works in some way like this:

Code: Select all

 [email protected]:~ $  somecommand can0 580#31000C00000000
can0 180   [7] B2 00 0C 00 19 00 00       <--- direct response to my request
 [email protected]:~ $
Thanks for your help and sorry if my english is creepy.

Stefan

scorpion_08
Posts: 2
Joined: Thu Mar 08, 2018 6:43 am

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

Thu Mar 08, 2018 6:46 am

[email protected]:~ $ sudo ip link set can0 up type can bitrate 1000000
RTNETLINK answers: Numerical argument out of domain

when i set data rate to 1mbs, there appears an error. can you help in this regard.

david_1234
Posts: 51
Joined: Mon Jan 01, 2018 2:14 pm

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

Thu Mar 15, 2018 3:19 pm

Cansome one help or guide me ?
when I connect the canbus to my car i get a lot of data
I want to see only the data I want
for example
only PID 156,111,164,265
how Do I do this?
is it something in the canutilitis I need to do ?
cansniffer?
or I need to write an external code that will read the candump and show mw only what I want ?

Thanks ,

andminsk
Posts: 4
Joined: Thu Mar 22, 2018 5:16 pm

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

Tue Apr 03, 2018 3:03 pm

Hi to all?
Does anybody know - is it possible to monitor 2-3 CAN bus line with one Pi?
Using several MCP2515

gaffer206
Posts: 5
Joined: Thu Dec 20, 2012 12:09 am

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

Thu Apr 05, 2018 6:30 am

andminsk wrote:
Tue Apr 03, 2018 3:03 pm
Hi to all?
Does anybody know - is it possible to monitor 2-3 CAN bus line with one Pi?
Using several MCP2515
You might look at https://www.sg-electronic-systems.com/e ... 2-canberry

gaffer206
Posts: 5
Joined: Thu Dec 20, 2012 12:09 am

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

Thu Apr 05, 2018 6:35 am

Hi,

I've got one of these modules to try to talk to some NMEA2000 devices. A couple of questions.

How important do you think the 1uF tantalum is if the 5V supply is a good one nearby?

I had a look at the TJA1050 specs and it says the RXD pin can be 0.7 VCC which at 5V would be 3.5 V which is more than the maximum 3.3 V input for the Pi. Have you done anything about this? Do you consider it a problem?

cheers

Julian

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

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

Mon Apr 16, 2018 10:08 pm

gaffer206 wrote:
Thu Apr 05, 2018 6:35 am
Hi,

I've got one of these modules to try to talk to some NMEA2000 devices. A couple of questions.

How important do you think the 1uF tantalum is if the 5V supply is a good one nearby?
I always put right beside the IC always a cap 100n fo generic digital or MCU (unless datasheet suggest more) chip, for line/bus drivers I usually put on power trace close to the chip a ceramic(or tantalum) 1+uF and ceramic 100n - the 100n might be not necessary but I never had any problems where the power supply was the culprit thanks to my caution :)
gaffer206 wrote:
Thu Apr 05, 2018 6:35 am
I had a look at the TJA1050 specs and it says the RXD pin can be 0.7 VCC which at 5V would be 3.5 V which is more than the maximum 3.3 V input for the Pi. Have you done anything about this? Do you consider it a problem?
U don't connect bus driver to Rpi , bus driver (MCP2551/TJA1050/etc) first need to be connected to CAN bus controller which is the MCP2515.

If u actually read my first post then U should see that I disconnected the CAN bus driver from 3,3V and connected it's power to 5V while keeping the MCP2515 powered from 3,3V. For MCP2515 this is no problem , we only have to worry for the side of MCP which talk to RPi - so that's why I power MCP2515 from 3,3V.
TJA1050: 0,7Vcc=3,5V -> I see this in output but in "conditions" columns (and this refer for RXD pin max currents) , not the min-max columns. Beside VIH is 2V this is much below 3,3V Vcc of MCP2515 :)

keyneaLai
Posts: 1
Joined: Mon Apr 23, 2018 8:32 am

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

Mon Apr 23, 2018 8:36 am

Holle:
my code:

Code: Select all

def SendBack(data):
msg = can.Message(arbitration_id=0x000601, data = data, extended_id=False)
bus.send(msg)
bus.flush_tx_buffer()
time.sleep(0.001)
try:
	Ans = str(bus.recv(timeout=1.0))
except:
	print("Error")
	return(None)
if(len(Ans) > 10):
	return("success")
else:
	return(None)
My question is when it lost recv then i cant send any new message.
it can't send any data and any response.
I need to restart Raspberry Pi then CAN bus will be normal.
Please help me to fix this question.
Thank you

gaffer206
Posts: 5
Joined: Thu Dec 20, 2012 12:09 am

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

Sun May 13, 2018 3:09 pm

saper_2 wrote:
Mon Apr 16, 2018 10:08 pm
gaffer206 wrote:
Thu Apr 05, 2018 6:35 am
Hi,

I've got one of these modules to try to talk to some NMEA2000 devices. A couple of questions.

How important do you think the 1uF tantalum is if the 5V supply is a good one nearby?
I always put right beside the IC always a cap 100n fo generic digital or MCU (unless datasheet suggest more) chip, for line/bus drivers I usually put on power trace close to the chip a ceramic(or tantalum) 1+uF and ceramic 100n - the 100n might be not necessary but I never had any problems where the power supply was the culprit thanks to my caution :)

Sure. Better safe. I'll follow your advice.
gaffer206 wrote:
Thu Apr 05, 2018 6:35 am
I had a look at the TJA1050 specs and it says the RXD pin can be 0.7 VCC which at 5V would be 3.5 V which is more than the maximum 3.3 V input for the Pi. Have you done anything about this? Do you consider it a problem?
U don't connect bus driver to Rpi , bus driver (MCP2551/TJA1050/etc) first need to be connected to CAN bus controller which is the MCP2515.

If u actually read my first post then U should see that I disconnected the CAN bus driver from 3,3V and connected it's power to 5V while keeping the MCP2515 powered from 3,3V. For MCP2515 this is no problem , we only have to worry for the side of MCP which talk to RPi - so that's why I power MCP2515 from 3,3V.
TJA1050: 0,7Vcc=3,5V -> I see this in output but in "conditions" columns (and this refer for RXD pin max currents) , not the min-max columns. Beside VIH is 2V this is much below 3,3V Vcc of MCP2515 :)
Thanks - I read it but got mixed up. You are right of course.

gunahmt
Posts: 15
Joined: Mon Jun 25, 2018 12:31 pm
Location: Turkey

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

Wed Jun 27, 2018 12:44 pm

Hi guys,
i have raspberry pi 3 B+. I get a problem in sending message.

Code: Select all

cansend can0 456#1234e67890123456
bash: cansend: command not found
my kernel version is;

Code: Select all

Linux raspberrypi 4.14.34-v7+ #1110 SMP Mon Apr 16 15:18:51 BST 2018 armv7l GNU/Linux
what is the problem?

EDIT: i installed can-utils and it is working now,but mcp2515 always sends message and i cant stop it.
EDIT 2 : i figure it out just need acknowledge message for stop.

vinnitu
Posts: 4
Joined: Thu Oct 03, 2013 8:32 pm

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

Fri Jul 06, 2018 9:05 am

Hello people!

I need help too! Maybe my information will be usable.

I have stm32f103 with tfj1050 - and I can communicate with rasp

oscilator=16000000
bitrate 1000000 in /etc/network/interfaces
but it is not 1Mb! It is more like ~140Kb
why?

now I try connect arduino uno + mcp2515 + mcp2551 + 8000 oscilator via spi 1Mb - and it doesnt work...

If I change bitrate to 500Kb - it works (< 500 ofcause) but I need 1Mb - what i need to do? is it possible in general?

thank you all!

vinnitu
Posts: 4
Joined: Thu Oct 03, 2013 8:32 pm

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

Tue Jul 10, 2018 7:08 am

vinnitu wrote:
Fri Jul 06, 2018 9:05 am
Hello people!

I need help too! Maybe my information will be usable.

I have stm32f103 with tfj1050 - and I can communicate with rasp

oscilator=16000000
bitrate 1000000 in /etc/network/interfaces
but it is not 1Mb! It is more like ~140Kb
why?

now I try connect arduino uno + mcp2515 + mcp2551 + 8000 oscilator via spi 1Mb - and it doesnt work...

If I change bitrate to 500Kb - it works (< 500 ofcause) but I need 1Mb - what i need to do? is it possible in general?

thank you all!
seems oscilator=16000000 + 1000000 bps give us 500000pbs (measured with logic analyzer)

so... is it possible make work as we wish?

Vladimir Abramov
Posts: 2
Joined: Thu Aug 09, 2018 5:30 pm

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

Thu Aug 09, 2018 5:41 pm

Hello. I successfully connect module to Pi 3b, configured by manual at topic start and get my nmea2000 frames. All fine.

I have only one problem. CPU usage. If even i disconnect module from bus driver still 1 core just for itself.

Code: Select all

%Cpu(s):  0.0 us, 21.6 sy,  0.0 ni, 78.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :   949452 total,   851924 free,    29880 used,    67648 buff/cache
KiB Swap:   102396 total,   102396 free,        0 used.   858772 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                          
  571 root     -51   0       0      0      0 R  71.5  0.0  10:10.95 irq/169-mcp251x                                                                                                  
  179 root      20   0       0      0      0 S  44.7  0.0   4:25.13 spi0  

Is it OK for this solution? Is there some hardware spi acceleration? Cpu usage is not a problem but heat, and device will be connected to battery and waste of power can by problem/

Vladimir Abramov
Posts: 2
Joined: Thu Aug 09, 2018 5:30 pm

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

Thu Aug 09, 2018 6:28 pm

Hello i have connected to my can network using this manual but have one issue.

Code: Select all

top - 17:34:59 up 14 min,  1 user,  load average: 0.83, 0.76, 0.49
Tasks:  92 total,   2 running,  50 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us, 21.6 sy,  0.0 ni, 78.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :   949452 total,   851924 free,    29880 used,    67648 buff/cache
KiB Swap:   102396 total,   102396 free,        0 used.   858772 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                          
  571 root     -51   0       0      0      0 R  71.5  0.0  10:10.95 irq/169-mcp251x                                                                                                  
  179 root      20   0       0      0      0 S  44.7  0.0   4:25.13 spi0        

Driver consumes 1 core. Even without connection to network itself.

Am I doing something wrong? I'm tried to change bandwidth but changes are insignificant.

Minzent
Posts: 1
Joined: Wed Aug 15, 2018 12:28 pm

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

Wed Aug 15, 2018 1:17 pm

hey guys,

I have the following problem:

I use a raspberry 3 with the latest version and a PiCAN2 RevB 09/15, everything installed following this guide -->

http://skpang.co.uk/catalog/images/rasp ... N2UG12.pdf

except that I cut out the "-overlay" in the config because otherwise it wouldnt bring up the can0 interface.

So the can0 is up and i can receive and send massages at 125 mbit/s and lower, no problem.

But i need to send and receive at 250 mbit/s.... That does not work whatsoever.

Am I missing something?

thanks

raspberry_CAN_i_?
Posts: 1
Joined: Thu Sep 13, 2018 7:36 am

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

Thu Sep 13, 2018 7:44 am

Hello sir a newbie here,

I use the exact same setup as @saper_2 ( MCP2515 and MCP2551), can0 is detected however there is no data flow from transceiver (candump can0 outputs nothing). Do I need a level-shifter or a resistor between the controller and the transceiver ?

Sorry for rewoking an old topic

vliev
Posts: 1
Joined: Tue Nov 06, 2018 12:33 am

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

Tue Nov 06, 2018 12:52 am

Hi, I am using 5v module and having 5 pins logic level shiftier from 3.3v to 5v, I am trying to remove one of Level shifter
pins are required only 5pins (SCK, MOSI, MISO, CS, INT,), However SCK is input to MCP2515, my understanding is not required to do any with this pin for level shifter. However MOSI, CS are input to MCP2515. While Vdd MCP2515 is 5.0V then Driving from RaspberryPi shoud be n problem?

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