Jump to content

martinayotte

Members
  • Posts

    3892
  • Joined

  • Last visited

Posts posted by martinayotte

  1. Unfortunately, all those boards are not providing easy access to SPI1, they are provding SPI0 instead.

    Even if PA15 is used for LED_STATUS, it is could probably still be used as SPI1_MOSI, since MOSI is "Master-Out-Slave-In".

    Of course, this LED maybe will affect speed efficiency, but you can give it a try.

    Also, you need to make sure that UART3 is disabled, and finally MUTE is the more difficult to access, since it it the PA16 SPI1_MISO, and should not be used as MUTE output anymore.

  2. Here is my W1 Overlay that I use on OPi+2E, you can tweak it to change the pin number you wish to use.

    /dts-v1/;
    /plugin/;
    
    / {
            compatible = "allwinner,sun8i-h3";
    
            fragment@0 {
                    target-path = "/";
                    __overlay__ {
    
                            w1: onewire@0 {
                                    compatible = "w1-gpio";
                                    pinctrl-names = "default";
                                    pinctrl-0 = <&w1_pins>;
                                    gpios = <&pio 3 14 0>; // PD14
                                    status = "okay";
                            };
                    };
            };
    
            fragment@1 {
                    target = <&pio>;
                    __overlay__ {
                            w1_pins: w1_pins {
                                    allwinner,pins = "PD14";
                                    allwinner,function = "gpio_in"; // in (initially)
                                    allwinner,pull = <0>; // off
                            };
                    };
            };
    
            __overrides__ {
                    gpiopin =       <&w1>,"gpios:4",
                                    <&w1_pins>,"allwinner,pins:0";
            };
    };
    
  3. I've never used WiringOP, but yes, principles should be similar. As for the python library, I've only change the LED_STATUS pin for PiZero, since it is PA17 instead of PA15.

    Although I didn't verify all other H3 pins, I presume it is pretty much the same.

     

    For I2C, here is a small python example of I2C GPIO Expander MCP23017 which blinks LEDs :

    #!/usr/bin/env python
    
    import sys, time
    from pyA20 import i2c
    
    i2c.init("/dev/i2c-0")
    i2c.open(0x20)
    i2c.write([0x00, 0x00])
    i2c.write([0x01, 0x00])
    while True:
    	i2c.write([0x12, 0x0F])
    	time.sleep(0.15)
    	i2c.write([0x12, 0xF0])
    	time.sleep(0.15)
    
  4. I must admit I'm not fluent with FEX, since I don't use Legacy any more since over 2 years.

    But yes, the number 2 is the MUX for TWI. But pins are not the ones from H3 (PBx don't exist on H3), they should be PA11/PA12 instead.

    Be aware that you also need to remove those 2 pins from the GPIOs list and reduce GPIOs count accordingly.

  5. @martinayotte has the same problem with his board, while for other people (including me) these images work fine. I have no idea if this is a HW issue or it can be solved on software level.
     

    I had this issue with my own build done before your official commit, so, maybe I missed something, since when rebuilded with your changes, the problem disappeared.

     

    Hm. I stil wonder if this is the same MMC pins pull-up issue that affects 4.10-rc kernels. In this case it can be easily fixed...

     

    I though that too, and was thinking that you've included that fix. Since you didn't, the problem was maybe elsewhere.

  6.  

    Hi msev, all pins except pin 5 work. On pin 5 I am getting the following error:

    File "blink_led.py", line 20, in <module>
        led = port.PA5
    AttributeError: 'module' object has no attribute 'PA5'
    Yes, with this lib I am able to set GPIO pins high and low. Even more, I can read GPIO pins values - HIGH and LOW.

    Effectively, there is no PA5 in the mapping.h, simply because PA5 is on Serial Debug UART0_RX.

  7. Michal so some pins work (for which the mapping is correct)?  Like pins 3, 5, 7 ,11, 13 and 15?  So with this lib I can do digital high and low?

     

    I2c is not connected to this library right, it works standalone? Martinayotte which library would be good to test i2c (do you know if it works on opizero)?

     

    Thanks guys for help!

     

    Yes the I2C and SPI is part of the library if you clone the git version. but be aware that I2C need to be enabled in the DT or FEX, depending of Legacy/Mainline kernels.

  8. Hi Martin,

    I have built and installed the GPIO library on my Orange Pi Zero that you suggested. But unfortunately I noticed that STATUS_LED pin is wrongly mapped after the install. I tried to build and install the library once again after the modification of the mapping.h but after the initialization of led >>>  led1 = port.STATUS_LED and print out >>> print led1 I am getting a wrong pin (15) instead of PA17. How shall I fix this problem? Thanks, Michal

    Yes, you have to tweak mapping.h and rebuild the library. If you still having issue, do an "rm -rf build" and then redo an "python setup.py install"

  9. I've already done a DT overlay several months ago, so here it is :

    // Definitions for w1-gpio module (without external pullup)
    /dts-v1/;
    /plugin/;
    
    / {
    	compatible = "allwinner,sun8i-h3";
    
    	fragment@0 {
    		target-path = "/";
    		__overlay__ {
    
    			w1: onewire@0 {
    				compatible = "w1-gpio";
    				pinctrl-names = "default";
    				pinctrl-0 = <&w1_pins>;
    				gpios = <&pio 3 14 0>; // PD14 
    				status = "okay";
    			};
    		};
    	};
    
    	fragment@1 {
    		target = <&pio>;
    		__overlay__ {
    			w1_pins: w1_pins {
    				allwinner,pins = "PD14";
    				allwinner,function = "gpio_in"; // in (initially)
    				allwinner,pull = <0>; // off
    			};
    		};
    	};
    
    	__overrides__ {
    		gpiopin =       <&w1>,"gpios:4",
    				<&w1_pins>,"allwinner,pins:0";
    	};
    };
    
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines