-
Posts
3892 -
Joined
-
Last visited
Content Type
Forums
Store
Crowdfunding
Applications
Events
Raffles
Community Map
Posts posted by martinayotte
-
-
BTW, recompiling /boot/boot.scr is only needed after changes to /boot/boot.cmd. Changes to /boot/armbianEnv.txt doesn't requires recompiling.
-
If you look at the H3 datasheet, they can not be move around to any other GPIOs ...
Which Orange do you have ? Did you look at the schematic ?
-
I'm not really fluent with FEX since I'm using Mainline since more than 2 years.
But from H3 Datasheet, the SPI1 is using PA13 to PA16 (not PA7 to PA10).
Also, the spi_dev_num = 2, since you have now 2 spidev.
-
Yes, this is the line to tweak :
self.spi.open(1, 0) # Open SPI port 1, slave device (CS) 1
Of couse, your DT or FEX also need to be tweak accordingly.
-
Only the starting pins are correct all the rest are incorrect.
Most of the pins on the zero are on PA registry unlike the "normal" PGXXX
https://raw.githubusercontent.com/duxingkei33/orangepi_PC_gpio_pyH3/master/pyA20/gpio/mapping.h
Since I have not test them all, which pins did you found incorrect ?
We can submit a PR if some correction is needed...
-
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"; }; };
-
You don't show the whole code, usually there is a spidev.open() where arguments describe port number.
-
Ah ! Ok ! I've misunderstood ...
-
(all of them except zero)
Why ? PiZero has the PL11 too ...
-
There is no need to do that, unless you load sunxi-gpio driver but AFAIK nobody use it, even Allwinner removed it from newer BSP kernels.
Right, I've forgot about that since I don't use Legacy since years ...
-
You probably only need to add "-lpthread" to the linker.
-
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)
-
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.
-
@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.
-
Although it is not really a tutorial, the FEX guide is here : http://linux-sunxi.org/Fex_Guide
-
In the above thread, I've mentioned the python library : https://github.com/duxingkei33/orangepi_PC_gpio_pyH3
It is currently support I2C and SPI, and although it is a python library, the C code inside can be used directly too.
-
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.PA5AttributeError: '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.
-
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.
-
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"
-
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"; }; };
-
@msev, in above post #2,' I've mentioned https://github.com/duxingkei33/orangepi_PC_gpio_pyH3, which is an H3 fork of the pyA20 from Olimex.
-
About email sent to Pantelis Antoniou , unfortunately, I've never got answer ...
I've re-send him email 2 days ago, but I doubt this guys will ever reply ...
I guest I will have to try getting answers from his co-Signed-Off, at least to know what is the state of those patches ...
-
Glad that you've finally got it working.
I don't know anything about rtlsdr-ogn, so maybe there are better ways, but at least, you're up and running.
Ciao !
-
You need to do the "chmod a+rx /home/ogn/rtlsdr-ogn/start.sh"
Then, try to start it manually using "/home/ogn/rtlsdr-ogn/start.sh"
How to use the second SPI interface on Orange?
in Allwinner sunxi
Posted
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.