Re: [beagleboard] Re: Microchip mcp2515, can over spi, not working. Wrong device tree overlay?
Hi! I got it to work, but not using the mainline driver. I bought a cape from towertech to be sure that my hardware was correct. They shipped the device with some modified version of the driver. Got some help in the beagle irc chat to try to find the origin of that driver. IIRC the driver was based on a driver from many years ago, but it works. I have not tested it over a long period, but it seems to work. I am currently trying to get it to work with the mainline driver, but its not my top priority right now. There has been several changes to the mainline driver since I tried to use it the last time, so i hope it will work next time I try it. With the towertech driver I managed to get it to work, both by using a overlay and just making my own DT. Should be instructions on how to compile if you download from these links. And I think there is a dto in the zip as well. If I get it to work with the mainline, I will update this thread. Btw. Some other guy on irc did not get this driver to work with his old rev of the can cape. I think I have rev5. Should work with that. TT3201 driver for Debian 7.x / Kernel 3.x < https://dl.dropboxusercontent.com/u/2883083/TowerTech/towertech-tt3201-rev5.tar.gz > * TT3201 driver for Debian 8.x / Kernel 4.x < https://dl.dropboxusercontent.com/u/2883083/TowerTech/towertech-tt3201-rev5-kernel-4.x.tar.gz > tirsdag 14. februar 2017 16.11.56 UTC+1 skrev Mark K Cowan følgende: > > Hi, > > Did you ever get the MCP2515 working over SPI? I'm attempting that now, > but I'm not sure where to start. > > Thanks, > Mark > > > > On Tuesday, 20 September 2016 14:30:39 UTC+1, Laurits Telle Riple wrote: >> >> After chatting in the IRC channel with Matthijs I was encouraged to not >> use overlays, and just make my own dtb. I have tried that now, but it >> doesn't seem to work properly. I've enabled spi0 and spi1. And used the >> spi_loopback to see that my dtb was working, then i expanded it by adding a >> clock node and adding the mcp in the spi config. Also, the max14830 not >> working, maybe the same issue? Anyways, this is my dtb: >> >> /* >> * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ >> * >> * This program is free software; you can redistribute it and/or modify >> * it under the terms of the GNU General Public License version 2 as >> * published by the Free Software Foundation. >> */ >> >> /dts-v1/; >> >> #include "am33xx.dtsi" >> #include "am335x-bone-common.dtsi" >> #include "am33xx-overlay-edma-fix.dtsi" >> #include "irq.h" >> >> / { >> model = "TI AM335x BeagleBone Black"; >> compatible = "ti,am335x-bone-black", "ti,am335x-bone", >> "ti,am33xx"; >> >> clk16m:clk16m{ >> compatible = "fixed-clock"; >> clock-frequency = <1600>; >> #clock-cells = <0>; >> }; >> >> clk4m:clk4m{ >> compatible = "fixed-clock"; >> clock-frequency = <400>; >> #clock-cells = <0>; >> }; >> }; >> >> _reg { >> regulator-min-microvolt = <180>; >> regulator-max-microvolt = <180>; >> regulator-always-on; >> }; >> >> { >> vmmc-supply = <_fixed>; >> }; >> >> { >> vmmc-supply = <_fixed>; >> pinctrl-names = "default"; >> pinctrl-0 = <_pins>; >> bus-width = <8>; >> status = "okay"; >> }; >> >> _opp_table { >> /* >> * All PG 2.0 silicon may not support 1GHz but some of the early >> * BeagleBone Blacks have PG 2.0 silicon which is guaranteed >> * to support 1GHz OPP so enable it for PG 2.0 on this board. >> */ >> oppnitro@10 { >> opp-supported-hw = <0x06 0x0100>; >> }; >> }; >> >> >> _pinmux{ >> spi1_pins:spi1_pins{ >> pinctrl-single,pins=< >> 0x190 0x33 /* mcasp0_aclkx.spi1_sclk, >> OUTPUT_PULLUP | MODE 3 */ >> 0x194 0x33 /* mcasp0_fsx.spi1_d0, >> INPUT_PULLUP | MODE3 */ >> 0x198 0x13 /* mcasp0_axr0.spi1_d1, >> OUTPUT_PULLUP | MODE 3 */ >> 0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, >>
Re: [beagleboard] Re: Microchip mcp2515, can over spi, not working. Wrong device tree overlay?
After chatting in the IRC channel with Matthijs I was encouraged to not use overlays, and just make my own dtb. I have tried that now, but it doesn't seem to work properly. I've enabled spi0 and spi1. And used the spi_loopback to see that my dtb was working, then i expanded it by adding a clock node and adding the mcp in the spi config. Also, the max14830 not working, maybe the same issue? Anyways, this is my dtb: /* * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ /dts-v1/; #include "am33xx.dtsi" #include "am335x-bone-common.dtsi" #include "am33xx-overlay-edma-fix.dtsi" #include "irq.h" / { model = "TI AM335x BeagleBone Black"; compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx"; clk16m:clk16m{ compatible = "fixed-clock"; clock-frequency = <1600>; #clock-cells = <0>; }; clk4m:clk4m{ compatible = "fixed-clock"; clock-frequency = <400>; #clock-cells = <0>; }; }; _reg { regulator-min-microvolt = <180>; regulator-max-microvolt = <180>; regulator-always-on; }; { vmmc-supply = <_fixed>; }; { vmmc-supply = <_fixed>; pinctrl-names = "default"; pinctrl-0 = <_pins>; bus-width = <8>; status = "okay"; }; _opp_table { /* * All PG 2.0 silicon may not support 1GHz but some of the early * BeagleBone Blacks have PG 2.0 silicon which is guaranteed * to support 1GHz OPP so enable it for PG 2.0 on this board. */ oppnitro@10 { opp-supported-hw = <0x06 0x0100>; }; }; _pinmux{ spi1_pins:spi1_pins{ pinctrl-single,pins=< 0x190 0x33 /* mcasp0_aclkx.spi1_sclk, OUTPUT_PULLUP | MODE 3 */ 0x194 0x33 /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */ 0x198 0x13 /* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE 3 */ 0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */ >; }; spi0_pins:spi0_pins{ pinctrl-single,pins=< 0x150 0x30 /* spi0_sclk, INPUT_PULLUP | MODE0 */ 0x154 0x30 /* spi0_d0, INPUT_PULLUP | MODE0 */ 0x158 0x10 /* spi0_d1, OUTPUT_PULLUP | MODE0 */ 0x15c 0x10 /* spi0_cs0, OUTPUT_PULLUP | MODE0 */ >; }; mcp2515_pins:mcp2515_pins{ pinctrl-single,pins=< 0x1ac 0x37 /*mcasp0_ahclkx.gpio3_21,RX_ENABLED | PULLUP | MODE7 */ >; }; max14830_pins:max14830_pins{ pinctrl-single,pins=< 0x1a4 0x37 /* mcasp0_fsr.gpio3_19, RX_ENABLED | PULLUP | MODE7 */ >; }; }; { status="okay"; pinctrl-names="default"; pinctrl-0=<_pins>; /*spi1@0{ compatible="spidev"; reg=<0>; spi-max-frequency=<1600>; };*/ max14830@0{ compatible="maxim,max14830"; reg=<0>; spi-max-frequency=<1600>; clocks=<>; clock-names="osc"; interrupt-parent=<>; interrupts=<19 IRQ_TYPE_EDGE_FALLING>; gpio-controller; #gpio-cells=<2>; }; mcp2515@1{ compatible="microchip,mcp2515"; reg=<1>; spi-max-frequency=<1000>; pinctrl-names="default"; pinctrl-0=<_pins>; clocks=<>; interrupt-parent=<>; interrupts=<21 IRQ_TYPE_EDGE_FALLING>; }; }; { status="okay"; pinctrl-names="default"; pinctrl-0=<_pins>; spi0@0{ compatible="spidev"; reg=<0>; spi-max-frequency=<1600>; }; }; But I still dont get any can devices when i issue the "ip a" command. However running lsmod gives: debian@arm:/opt/source/dtb-4.4-ti$ lsmod Module Size Used by 8021q 17930 0 garp5769 1 8021q mrp 7239 1 8021q stp 2219 1 garp llc 5123 2 stp,garp usb_f_ecm 9336 1 g_ether 4976 0 usb_f_rndis22191 2 g_ether mcp251x 9039 0 u_ether11898 3 usb_f_ecm,usb_f_rndis,g_ether libcomposite 43717 3 usb_f_ecm,usb_f_rndis,g_ether