Jump to content

Vadzim Yatskevich

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by Vadzim Yatskevich

  1. 20 часов назад, Aleksey сказал:

     

    Just instead of  

    interrupts = <0 7 2>; /* PA7 IRQ_TYPE_EDGE_FALLING */ 
    put the correct value  
    interrupts = <0 7 IRQ_TYPE_LEVEL_LOW>;    

    And everything will work for you including Linux 5.11

     

    Just a Linux 5.5 driver, uses sleep functions in the MCP2515, and the IRQ_TYPE_EDGE_FALLING interrupt cannot be handled.

     

     

     

     

    Getting compilation error with "interrupts = <0 2 IRQ_TYPE_LEVEL_LOW>;" 

    But  when using  " interrupts = <0 2 8>; /* PA2 IRQ_TYPE_LEVEL_LOW */ " (is that what Aleksey meant?) compilation is successfull and  CAN interface is fully functional on Linux 5.10.16-sunxi

     

  2. 17.01.2021 в 19:09, Vadzim Yatskevich сказал:

    Can anyone explain strange driver behavior, actual CAN module connection:

    MCP2515 Opi Zero H2
    INT PA7
    SCK PA14
    SI PA15
    SO PA16
    CS PA13
    GND GND
    5V 5V

     

    Either I write in overlay pins = "PA2"; or pins = "PA7"; mcp2515 is successfully initialized

    
    
    dasio@orangepizero:~$ dmesg | grep mcp
    [   11.495643] mcp251x spi0.0 can0: MCP2515 successfully initialized.

    But in case of pins = "PA7"; command  "sudo ip link set up can0 type can bitrate 500000" leads system to hang

    When in overlay pins = "PA2"; (that does not correspond to physical connection) CAN bus became functional

     

     

      Показать содержимое
    
    
    
    
    /dts-v1/;
    /plugin/;
    
    / {
    	compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
    
    	fragment@0 {
    		target-path = "/clocks";
    		__overlay__ {
    			#address-cells = <1>;
    			#size-cells = <1>;
    			can0_osc_fixed: can0_osc_fixed {
    				compatible = "fixed-clock";
    				#clock-cells = <0>;
    				clock-frequency  = <8000000>;
    			};
    		};
    	};
    
    	fragment@1 {
    		target = <&pio>;
    		__overlay__ {
    			can0_pin_irq: can0_pin_irq {
    				pins = "PA2";
    				function = "irq";
    				bias-pull-up;
    			};
    		};
    	};
    
    	fragment@2 {
    		target = <&spi1>;
    		__overlay__ {
    			#address-cells = <1>;
    			#size-cells = <0>;
    			status = "okay";
    			mcp2515 {
    				reg = <0>;
    				compatible = "microchip,mcp2515";
    				pinctrl-names = "default";
    				pinctrl-0 = <&can0_pin_irq>;
    				spi-max-frequency = <10000000>;
    				interrupt-parent = <&pio>;
    				interrupts = <0 7 2>; /* PA7 IRQ_TYPE_EDGE_FALLING */
    				clocks = <&can0_osc_fixed>;
    				status = "okay";
    			};
    		};
    	};
    };

     

     

    So finally I found a dirty solution to have CAN bus on Orange pi Zero and Orange pi Zero plus 2. Downgrade to kernel version Linux 5.4.x (Linux 5.4.58-sunxi in my case) makes interrupt pins behavior completely adequate. Possible to use PA7 (for Orange pi Zero) and PA2 (Orange pi Zero plus 2).

  3. Can anyone explain strange driver behavior, actual CAN module connection:

    MCP2515 Opi Zero H2
    INT PA7
    SCK PA14
    SI PA15
    SO PA16
    CS PA13
    GND GND
    5V 5V

     

    Either I write in overlay pins = "PA2"; or pins = "PA7"; mcp2515 is successfully initialized

    dasio@orangepizero:~$ dmesg | grep mcp
    [   11.495643] mcp251x spi0.0 can0: MCP2515 successfully initialized.

    But in case of pins = "PA7"; command  "sudo ip link set up can0 type can bitrate 500000" leads system to hang

    When in overlay pins = "PA2"; (that does not correspond to physical connection) CAN bus became functional

     

     

    Скрытый текст
    
    
    /dts-v1/;
    /plugin/;
    
    / {
    	compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
    
    	fragment@0 {
    		target-path = "/clocks";
    		__overlay__ {
    			#address-cells = <1>;
    			#size-cells = <1>;
    			can0_osc_fixed: can0_osc_fixed {
    				compatible = "fixed-clock";
    				#clock-cells = <0>;
    				clock-frequency  = <8000000>;
    			};
    		};
    	};
    
    	fragment@1 {
    		target = <&pio>;
    		__overlay__ {
    			can0_pin_irq: can0_pin_irq {
    				pins = "PA2";
    				function = "irq";
    				bias-pull-up;
    			};
    		};
    	};
    
    	fragment@2 {
    		target = <&spi1>;
    		__overlay__ {
    			#address-cells = <1>;
    			#size-cells = <0>;
    			status = "okay";
    			mcp2515 {
    				reg = <0>;
    				compatible = "microchip,mcp2515";
    				pinctrl-names = "default";
    				pinctrl-0 = <&can0_pin_irq>;
    				spi-max-frequency = <10000000>;
    				interrupt-parent = <&pio>;
    				interrupts = <0 7 2>; /* PA7 IRQ_TYPE_EDGE_FALLING */
    				clocks = <&can0_osc_fixed>;
    				status = "okay";
    			};
    		};
    	};
    };

     

     

×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines