Interfacing

BPi and mcp2515

5 1972
shigeki  
Hi everyone.
Im trying to configure bananian 15.08 to work with mcp2515 CANBus controler.
I add all can module, spi-sun7i and mcp211x to /etc/modules to autoload modules at booting.
  1. #lsmod

  2. mcp251x                 9520  0
  3. can_gw                  7628  0
  4. can_bcm                11648  0
  5. can_raw                 5960  0
  6. can_dev                 9214  1 mcp251x
  7. can                    23848  3 can_gw,can_bcm,can_raw
  8. spidev                  6382  0
  9. spi_sun7i              19729  0
Copy the Code
  1. #dmesg

  2. [   28.164615] [spi-inf] Found 2 spi devices in config files
  3. [   28.183731] [spi-inf] boards num modalias         max_spd_hz       bus_num  cs   mode
  4. [   28.202193] [spi-inf] spi_board0 irq gpio not used
  5. [   28.220667] [spi-inf] 0          spidev           12000000         0        0    0x3
  6. [   28.239199] [spi-inf] spi_board1 irq gpio not used
  7. [   28.257576] [spi-inf] 1          spidev           12000000         0        1    0x3
  8. [   28.277385] [spi-inf] sun7i_spi_probe: spi0 dma type: normal
  9. [   28.293536] [spi-inf] bus num = 0, spi used = 3
  10. [   28.309465] [spi-inf] sun7i_spi_probe: spi0 cs bitmap: 0x3
  11. [   28.336909] [spi-inf] sun7i_spi_set_mclk: spi0 source = sdram_pll_p, src_clk = 864000000, mclk 96000000
  12. [   28.359566] sun7i-spi sun7i-spi.0: master is unqueued, this is deprecated
  13. [   28.382724] [spi-inf] sun7i_spi_probe: reuuimlla's SoC SPI Driver loaded for Bus SPI0 with 2 Slaves at most
  14. [   28.409567] [spi-inf] sun7i_spi_probe: spi0 driver probe succeed, base f01ba000, irq 42, dma_id_rx 24, dma_id_tx 24
  15. [   28.473644] can: controller area network core (rev 20090105 abi 8)
  16. [   28.491037] NET: Registered protocol family 29
  17. [   28.559943] CAN device driver interface
  18. [   28.612884] can: raw protocol (rev 20090105)
  19. [   28.674237] can: broadcast manager protocol (rev 20090105 t)
  20. [   28.729246] can: netlink gateway (rev 20101209)
  21. [   30.337421] GMAC gpio_power_hd:gpio_direction_output
  22. [   30.601639] eth0: device MAC address 02:52:0a:01:a2:c5
  23. [   30.626888] sunxi_gmac: probed
  24. [   30.641404] eth0: PHY ID 001cc915 at 0 IRQ 0 (sunxi_gmac-0:00) active
  25. [   30.658729] eth0: PHY ID 001cc915 at 1 IRQ 0 (sunxi_gmac-0:01)
  26. [   35.664141] PHY: sunxi_gmac-0:00 - Link is Up - 1000/Full
Copy the Code

Interface can0 is not aviable.

igorpec  

shigeki  
Thanks for reply,.
I download distro for Banana Pi and run smoothly, but i had problem to run spi module .
In Bananian to run spi is only modprobe spi-sun7i.
This thread dont help me  to run spi : http://forum.armbian.com/index.php/topic/637-armbian-483-spi-driver/
I don't have much experience with Linux to manipulate without how to for specify hardware.

Linux with spi and mcp2515 is very exotic combination?? I know a20 have Can Bus controller but i have mcp and i want to use it to communicate with another mcp in bus.

igorpec  
In Armbian spi is part of kernel on both kernels, 3.4.+ and 4.4.+ No need to load modules.

You "only" need to enable and configure it in script.fex or dtb. I know it's not a trivial job to do.

shigeki  
In /boot/dtb/sun7i-a20-bananapi.dtb i have this descriptor:
spi@01c05000 {
                        compatible = "allwinner,sun4i-a10-spi";
                        reg = <0x1c05000 0x1000>;
                        interrupts = <0x0 0xa 0x4>;
                        clocks = <0x3 0x14 0x15>;
                        clock-names = "ahb", "mod";
                        dmas = <0x16 0x1 0x1b 0x16 0x1 0x1a>;
                        dma-names = "rx", "tx";
                        status = "okay";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <0x17 0x18 0x19>;
                };

spi@01c06000 {
                        compatible = "allwinner,sun4i-a10-spi";
                        reg = <0x1c06000 0x1000>;
                        interrupts = <0x0 0xb 0x4>;
                        clocks = <0x3 0x15 0x1a>;
                        clock-names = "ahb", "mod";
                        dmas = <0x16 0x1 0x9 0x16 0x1 0x8>;
                        dma-names = "rx", "tx";
                        status = "disabled";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                };

In this thread http://forum.armbian.com/index.php/topic/637-armbian-483-spi-driver/#entry4518is to change status to okay and add pin description, next entry contain filed verision of this spi
spi@01c05000 {                        compatible = "allwinner,sun4i-a10-spi";
                        reg = <0x1c05000 0x1000>;
                        interrupts = <0x0 0xa 0x4>;
                        clocks = <0x3 0x14 0x13>;
                        clock-names = "ahb", "mod";
                        dmas = <0x14 0x1 0x1b 0x14 0x1 0x1a>;
                        dma-names = "rx", "tx";
                        status = "okay";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <0x15 0x16 0x17>;
                };

Which pinctrl-0 is good??
In a20 datasheet is only this :
a20_SPI_GPIO.jpeg


The LEMAKER has the forum of interfacing and making the interface of the object in determine ways. The forum of the hardware and the peripheral available at https://www.topratedessayservice.com is with the rating at the top by essay services to grant the thinking.

You have to log in before you can reply Login | Sign Up

Points Rules