

TRay
Members-
Posts
60 -
Joined
-
Last visited
Content Type
Forums
Store
Crowdfunding
Applications
Events
Raffles
Community Map
Everything posted by TRay
-
How to set correctly GPIO flags in dts files?
TRay replied to TRay's topic in Advanced users - Development
Reading many others documents about OPEN DRAIN flag , OZPI v3 and others like Raspberry Pi don't support Open DRAIN, but they should work in emulated mode, switching between input and output-driving-low. So for this reason if we set flag for GPIO with OPEN DARIN it looks not influence and not need setting this flag for w1-gpio for this SBC -
Hi, I managed to make w1-GPIO work in Orange Pi Zero v3 for, for example, the DS18B20 sensor. However, I have some doubts about setting the GPIO flags for w1-gpio. Many examples provide flags in the form gpios = <&pio 0 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; but in the dts file when I use this form it does not work (syntax error) so I have to provide the flags in digital form. A description of flags and bits is here https://elixir.bootlin.com/linux/v6.6.30/source/include/dt-bindings/gpio/gpio.h If I would like to set GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN then the digital value for these bits will be for set bits: 0110000 = 48 because GPIO_OPEN_DRAIN it is (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_DRAIN) Please help me and confirm whether I understood it correctly I wanted to get rid of the message in the logs for w1-gpio [ 4.994183] gpio-74 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file which understands that I need to set the GPIO flag GPIO_OPEN_DRAIN in the dts file I see one problem with this source https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio.txt where a number of bits to set is 6 in source https://elixir.bootlin.com/linux/v6.6.30/source/include/dt-bindings/gpio/gpio.h number of bits to set is 7 I hope I posted this question in the right section, if not please move it
-
I used simple dts file as possible : /dts-v1/; /plugin/; / { model = "OrangePi Zero3"; compatible = "xunlong,orangepi-zero3", "allwinner,sun50i-h618"; fragment@0 { target-path = "/"; __overlay__ { w1: onewire@0 { compatible = "w1-gpio"; pinctrl-names = "default"; gpios = <&pio 2 7 0>; status = "okay"; }; }; }; }; compiled: armbian-add-overlay w1-gpio.dts and works 🙂 with armbianEnv.txt user_overlays=w1-gpio param_w1_pin=PC10 param_w1_pin_int_pullup=0 demsg show [ 5.015541] Driver for 1-wire Dallas network protocol. [ 5.019754] gpio-74 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file [ 5.046831] w1_master_driver w1_bus_master1: Attaching one wire slave 28.03165129ecff crc 24 and cat /sys//bus/w1/devices/28-03165129ecff/w1_slave 76 01 4b 46 7f ff 0c 10 d3 : crc=d3 YES 76 01 4b 46 7f ff 0c 10 d3 t=23375 SBC DS18B20 VCC (3V3) Pin 1 ---------- VCC DS18B20 | R1 = 4k7 | GPIO74 Pin 26 --------- Data DS18B20 GND Pin 6 ---------- GND DS18B20
-
I would like to ask about the entry in armbiaEnv.txt in the ArmBian distribution for Orange Pi Zero 3 overlay_prefix=sun50i-h616 does it have anything to do with the file in the directory? /boot/dtb-6.6.30-current-sunxi64/allwinner/sun50i-h618-orangepi-zero3.dtb For OZPI version 3 there is a prefix sun50i-h618 and in armbianEnv.txt there is overlay_prefix=sun50i-h616 shouldn't it be sun50i-h618 ?? I'm asking about this because I have a problem with using overlay for w1-gpio for OZPI v3, so I am looking for the source of the problem in various places
-
I try to understand problem [ 4.997793] sun50i-h616-pinctrl 300b000.pinctrl: pin PC10 already requested by onewire@0; cannot claim for 300b000.pinctrl:74 and I see this message is generate by: https://github.com/torvalds/linux/blob/master/drivers/pinctrl/pinmux.c#L102 /** * pin_request() - request a single pin to be muxed in, typically for GPIO * @pctldev: the associated pin controller device * @pin: the pin number in the global pin space * @owner: a representation of the owner of this pin; typically the device * name that controls its mux function, or the requested GPIO name * @gpio_range: the range matching the GPIO pin if this is a request for a * single GPIO pin */ ...... if ((!gpio_range || ops->strict) && desc->mux_usecount && strcmp(desc->mux_owner, owner)) { dev_err(pctldev->dev, "pin %s already requested by %s; cannot claim for %s\n", desc->name, desc->mux_owner, owner); goto out; } if ((gpio_range || ops->strict) && desc->gpio_owner) { dev_err(pctldev->dev, "pin %s already requested by %s; cannot claim for %s\n", desc->name, desc->gpio_owner, owner); goto out; } .....
-
Maybe I need a change in my w1-gpio.dts looking to https://elixir.bootlin.com/linux/v6.6.30/source/arch/arm64/boot/dts/allwinner compatible = "allwinner,sun50i-h616"; to model = "OrangePi Zero3"; compatible = "xunlong,orangepi-zero3", "allwinner,sun50i-h618"; and add #include "sun50i-h616-orangepi-zero.dtsi" like in https://elixir.bootlin.com/linux/v6.6.30/source/arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero3.dts
-
Unfortunately, my programming knowledge is low and knowledge of DTS Overlays + source code of w1-gpio linux kernel does not allow me to find the source of the problem [ 4.997793] sun50i-h616-pinctrl 300b000.pinctrl: pin PC10 already requested by onewire@0; cannot claim for 300b000.pinctrl:74
-
Ha, interesting ... I have put in armbianEnv.txt instead pc10 now param_w1_pin=gpio71 where gpio71 is number line for PC7 which is not connected DS18B20 🙂 at current is nothing connected and working w1-gpio with info log where is show PC10/gpio-74 [ 4.957396] Driver for 1-wire Dallas network protocol. [ 4.960325] w1-gpio onewire@0: there is not valid maps for state default [ 4.960433] gpio-74 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file [ 4.986579] w1_master_driver w1_bus_master1: Attaching one wire slave 28.03165129ecff crc 24 cat /sys/bus/w1/devices/28-03165129ecff/w1_slave 5f 01 4b 46 7f ff 0c 10 12 : crc=12 YES 5f 01 4b 46 7f ff 0c 10 12 t=21937 I can not understand this
-
Summary, In all examples to use w1-gpio in Armbian in armbinaEnv.txt always is name of gpio is write in capital letters for example PC10 param_w1_pin=PC10 but when we use PC10 w1-gpio not works and in log is message: [ 4.997793] sun50i-h616-pinctrl 300b000.pinctrl: pin PC10 already requested by onewire@0; cannot claim for 300b000.pinctrl:74 command cat /sys/kernel/debug/gpio did not show that gpio 74 / PC10 is used command but when we use name gpio in lowercase letters pc10 w1-gpio works and show data from DS18B20 but show message in log [ 9.366246] w1-gpio onewire@0: there is not valid maps for state default command cat /sys/kernel/debug/gpio show gpiochip0: GPIOs 0-287, parent: platform/300b000.pinctrl, 300b000.pinctrl: gpio-74 ( |onewire@0 ) out hi and we can see data from DS18B20 cat /sys/bus/w1/devices/28-03165129ecff/w1_slave 53 01 4b 46 7f ff 0c 10 2d : crc=2d YES 53 01 4b 46 7f ff 0c 10 2d t=21187 for me, it is bug or in kernel 6.6.30 or overlay for Ornage Pi Zreo v3
-
I have checked what hapen when on Ornage Pi Zero v1 with kernel 6.1.63 in armbianEnv.txt use pa14 instead PA14 in log I see [ 9.358693] Driver for 1-wire Dallas network protocol. [ 9.366246] w1-gpio onewire@0: there is not valid maps for state default [ 9.368019] gpio-110 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file and w1-gpio not working and no files in /sys/bus/w1/devices/ but we see marked in red the same information that I have on OZPI v3 when I use pc10 instead of PC10 but on OZPI v3 DS18B20 works and on OZPI v1 it doesn't work when I use the lower case name gpio This looks like some kind of bug in kernel 6.6.30 on OZPI v3
-
Yes, that's right, I can ignore it when I have a working w1-gpio on OZPI v3, but it would be nice to see how to fix it so that it works correctly. But what's strange to me is that I have to use the gpio name in lower case and not in upper case as it was always described in the w1-gpio examples. I tried to use the name with gpiod, i.e. "gpio74", instead of names like PC10, but it didn't work, so it occurred to me to try writing the name in lower case "pc10" instead of capital letters as usual, and I found that it worked, but I think it's not normal since capital letters have been used so far, I will check on OZP v1 whether it will work if I change to lowercase letters Thank you for exchanging ideas and tips on solving the problem
-
Yes "no maps for state" is connected with but in all examples .dts is used : pinctrl-names = "default";
-
But I am not use gpio PC10 by another application etc, I define PC10 only for w1-gpio in armbianEnv.tx but when I use PC10 instead pc10 w1-gpio is not working and I can not read data DS18B20. When I use pc10 all working and I read atat from DS18B20 so info in log: pin PC10 already requested by onewire@0; cannot claim for 300b000.pinctrl:74 give me that w1-gpio is not working
-
But it is interesting most of examples armbianEnv.txt for parameters param_w1_pin=PC10 show name of gpio in use capital letters but when I use name in capital letters is problem and show in demsg info [ 4.997793] sun50i-h616-pinctrl 300b000.pinctrl: pin PC10 already requested by onewire@0; cannot claim for 300b000.pinctrl:74 and 1-Wire not working but when I use name of gpio in lowercase letters pc20 1-Wire works and show temperature from DS18B20 but is info [ 4.994076] w1-gpio onewire@0: there is not valid maps for state default It maybe any bug ?
-
Wow 🙂 I have success dmesg | grep -i wire* [ 4.991132] Driver for 1-wire Dallas network protocol. [ 4.994076] w1-gpio onewire@0: there is not valid maps for state default [ 4.994183] gpio-74 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file [ 5.021347] w1_master_driver w1_bus_master1: Attaching one wire slave 28.03165129ecff crc 24 cat /sys/bus/w1/devices/28-03165129ecff/w1_slave 54 01 4b 46 7f ff 0c 10 fd : crc=fd YES 54 01 4b 46 7f ff 0c 10 fd t=21250 What do I change in /boot/armbianEnv.txt Instead of capital letters PC10, I used in lowercase letters pc10 for the gpio name stupid mistake on my part and maybe I suggested examples param_w1_pin=pc10 param_w1_pin_int_pullup=0 user_overlays=w1-gpio So we can now use sensors like DS18B20 etc with w1-gpio on Orange Pi Zero v3 w with w1-gpio.dts: /dts-v1/; /plugin/; / { compatible = "allwinner,sun50i-h616"; fragment@0 { target = <&pio>; __overlay__ { w1_pins: w1_pins { pins = "PC10"; function = "gpio_in"; }; }; }; fragment@1 { target-path = "/"; __overlay__ { onewire@0 { compatible = "w1-gpio"; pinctrl-names = "default"; pinctrl-0 = <&w1_pins>; gpios = <&pio 2 10 0>; /* PC10 */ status = "okay"; }; }; }; }; I don't know what I need to correct to remove this info: [ 4.994076] w1-gpio onewire@0: there is not valid maps for state default
-
Form firs message from dmesg is not clear sun50i-h616-pinctrl 300b000.pinctrl: pin PC10 already requested by onewire@0; cannot claim for 300b000.pinctrl:74 I see many similar problems z similar info for UART SPI etc , I suppose that we need to solve this problem or I am wrong
-
I connect DS18B20 to orange Pi Zero on Armbian 23.02.2 Bullseye with Linux 6.1.63 Via armbian-config in Hardware enabled w1_gpio and add to armbiaEnv.txt param_w1_pin=PA14 param_w1_pin_int_pullup=0 and in overlyas= was w1_gpio cat /sys/bus/w1/devices/28-03165129ecff/w1_slave 54 01 4b 46 7f ff 0c 10 fd : crc=fd YES 54 01 4b 46 7f ff 0c 10 fd t=21250 cat /sys/kernel/debug/gpio gpiochip0: GPIOs 0-223, parent: platform/1c20800.pinctrl, 1c20800.pinctrl: gpio-14 ( |onewire@0 ) out hi gpio-17 ( |orangepi:red:status ) out lo gpio-20 ( |reg_vcc_wifi ) out hi gpio-166 ( |cd ) in lo ACTIVE LOW gpio-204 ( |usb0_id_det ) in hi IRQ dmesg |grep wire* [ 9.398674] Driver for 1-wire Dallas network protocol. [ 9.410366] gpio-14 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file [ 9.463654] w1_master_driver w1_bus_master1: Attaching one wire slave 28.03165129ecff crc 24 so all working very well on OZPI v1 with kernel 6.163 on Armbian 23.02.2 So my DS18B20 is work but on OZPI v3 with 6.6.30 kernel and user overlay for w1-gpio not work for me. It maybe we need more add in overlay for w1-gpio.dts?
-
I checked new sensor DS18B20 but still the same error in dmesg info, so I will try with my RPI or OZPI v1 z kernel 6.1 check use w1-gpio overlay
-
Thank you for your answer and suggestions. Hmm, the problem is that I have a DS18B20 sensor connected to OZPIv3, which I used in another project on another SBC. PIN DATA DS18B20 is connected to PC10 and through the 4k7 resistor to VCC 3.3V and the third pin DS18B20 to GND I will have to check this sensor again to see if RPI or OZPIv1 works on the 6.1.x kernel or I will take another unit for testing.
-
I read again info https://docs.armbian.com/User-Guide_Allwinner_overlays/ and compile overlay by command: armbian-add-overlay w1-gpio.dts I see that in /boot/overlay-user/ is file w1-gpio.dtbo in /boot/armbianEnv.txt user_overlays=w1-gpio param_w1_pin=PC10 param_w1_pin_int_pullup=1 after this I reboot OZPI v3 after restart OZPIv3 I check dmesg info where found [ 4.990724] Driver for 1-wire Dallas network protocol. [ 4.997793] sun50i-h616-pinctrl 300b000.pinctrl: pin PC10 already requested by onewire@0; cannot claim for 300b000.pinctrl:74 [ 4.997833] w1-gpio onewire@0: gpio_request (pin) failed [ 4.997841] w1-gpio: probe of onewire@0 failed with error -22 cat /sys/kernel/debug/gpio gpiochip0: GPIOs 0-287, parent: platform/300b000.pinctrl, 300b000.pinctrl: gpio-76 ( |red:status ) out lo gpio-77 ( |green:power ) out hi gpio-80 ( |regulator-usb1-vbus ) out hi gpio-166 ( |cd ) in lo ACTIVE LOW gpio-210 ( |reset ) out hi ACTIVE LOW Can anyone help?
-
Refer to https://docs.armbian.com/User-Guide_Allwinner_overlays/ The file sun50i-h616-w1-gpio.dtbo should be copied to /boot/overlay-user/ and /boot/armbinaEnv.txt should be to contain for DS18B20 connected to GPIO 74/PC10 user_overlays=w1-gpio param_w1_pin=PC10 param_w1_pin_int_pullup=1
-
I found information that this is a dtc issue. The error can be suppressed with -W no-unit_address_vs_reg, for example: dtc -W no-unit_address_vs_reg -O dtb -o sun50i-h616-w1-gpio.dtbo sun50i-h616-w1-gpio.dts or warning can be squashed by adding #address-cells and #size-cells
-
Much better, but still warning: sun50i-h616-w1-gpio.dts:20.35-26.27: Warning (unit_address_vs_reg): /fragment@1/__overlay__/onewire@0: node has a unit name, but no reg or ranges property
-
I found another example dtoverlay support for 1-wire subsystem on H616 devices https://github.com/orangepi-xunlong/linux-orangepi/pull/21 /dts-v1/; /plugin/; / { compatible = "allwinner,sun50i-h616"; fragment@0 { target = <&pio>; __overlay__ { w1_pins: w1_pins { pins = "PC10"; function = "gpio_in"; }; }; }; fragment@1 { target-path = "/"; __overlay__ { onewire@0 { compatible = "w1-gpio"; pinctrl-names = "default"; pinctrl-0 = <&w1_pins>; gpios = <&pio 2 10 0>; /* PC10 */ status = "okay"; }; }; }; }; I will try used
-
I tried to make of file with command: dtc -O dtb -o sun50i-h616-w1-gpio.dtbo sun50i-h616-w1-gpio.dts but result is with warring so we can not use example from Orange Pi Zero 2 to create dtbo file for OZPI v3 ? Warning (unit_address_vs_reg): /__local_fixups__/fragment@1/__overlay__/onewire@0: node has a unit name, but no reg or ranges property sun50i-h616-w1-gpio.dts:27.33-69: Warning (gpios_property): /fragment@1/__overlay__/onewire@0:gpios: cell 1 is not a phandle reference sun50i-h616-w1-gpio.dts:27.33-69: Warning (gpios_property): /fragment@1/__overlay__/onewire@0:gpios: Could not get phandle node for (cell 1)