This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[OP2] SPI device MCP2515 spidev
#1
Hi,
I have make a new thread for this problem:
MCP2515 on CE1 do not work at same time with moitessier hat.
(2.0.21 Pi 4)
I have find out following:
By adding:
dtoverlay=mcp2515-can1,cs=1,oscillator=16000000,interrupt=25
throug the CAN BUS App of openplotter the SPI with CE1 should be load.


Code:
dmesg | grep -i -E "(mcp|spi)"

says:
[    4.689934] mcp251x spi0.1 can0: MCP2515 successfully initialized.

so far all right
but in the devicetree the SPI is called spidev0.0
I think that shoul make problems with Moitessier driver?
  Reply
#2
(01-13-2020, 04:59 AM)glowntiger Wrote: Hi,
I have make a new thread for this problem:
MCP2515 on CE1 do not work at same time with moitessier hat.
(2.0.21 Pi 4)
I have find out following:
By adding:
dtoverlay=mcp2515-can1,cs=1,oscillator=16000000,interrupt=25
throug the CAN BUS App of openplotter the SPI with CE1 should be load.


Code:
dmesg | grep -i -E "(mcp|spi)"

says:
[    4.689934] mcp251x spi0.1 can0: MCP2515 successfully initialized.

so far all right
but in the devicetree the SPI is called spidev0.0
I think that shoul make problems with Moitessier driver?

Hi, I can or should do something to correct. If you explain step by step what to do then I am attaching what you need! A pity if it wasn't solved for the next fair there!  Huh Big Grin Angry
  Reply
#3
Hi Sailoog,
I´m not realy conform with overlays.... But what do you think:
The original raspberry overlay:
https://github.com/raspberrypi/linux/blo...verlay.dts
Here the SPI is load to 0/1:


Code:
/* the spi config of the can-controller itself binding everything together */
   fragment@4 {
       target = <&spi0>;
       __overlay__ {
           /* needed to avoid dtc warning */
           #address-cells = <1>;
           #size-cells = <0>;
           can1: mcp2515@1 {
               reg = <1>;
               compatible = "microchip,mcp2515";
               pinctrl-names = "default";
               pinctrl-0 = <&can1_pins>;
               spi-max-frequency = <10000000>;
               interrupt-parent = <&gpio>;
               interrupts = <25 0x2>;
               clocks = <&can1_osc>;


And here the moitessier is also load to 0/1:
https://github.com/mr-rooney/moitessier-...8c1f389773

Code:
   moitessier0: moitessier@0{
        compatible = "rooco,moitessier";
        #address-cells = <1>;
        #size-cells = <0>;
What do you think?
  Reply
#4
Let's not panic, everything is working right Wink
The only wrong thing here is the way we check if the SPI is enabled. We use lsmod to check if spidev is present in the list but when you enable MCP2515 lsmod no longer returns spidev. Just do not trust the warning messages of SPI being disabled because it is enabled and working.

The solution is to switch to another flag. I have tested spi_bcm2835 and it works for MCP2515 enabled and disabled in my Raspberry 4 but I need to know if this is true for raspberry 3 too. Please could you test in RPi3 typing this in the terminal for both states (with MCP2515 and without)?

Code:
lsmod | grep spi_bcm2835

You should get something like:


Code:
spi_bcm2835            20480  0
  Reply
#5
Hi Sailoog,
thanks.. sometimes the solutions are quite easy... Shy  Tongue

This is on my Pi 4
Code:
spi_bcm2835            20480  0

On Pi 3 I check in the evening...
Thanks
Thomas
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)