PWM trouble and drive strength

Hello
I want to use the Radxa Zero for teaching robotic and i build a camera guided robot with this board.
I went in trouble with the PWM to control the DC motor via an optocoupled driver (DFrobot DRI0041).
One PWM work well but the level is low: 1.12V high: 3.2V it is on pin 40 - GPIOAO_11. The other is on pin 18 - GPIOX_8, when nothing is connected the level is good (0-3.3V) but when connecting the driver levels are : low 1.4V and it is not detected as 0.
I have inverted the 2 inputs of the driver. They work well with pin40 but not pin18.
I try to play with drive strength but the devicetree is not my cup of tea… I try this ( but doing that don’t change anything).

/dts-v1/;

/ {
compatible = “radxa,zero\0amlogic,g12a”;

    fragment@0 {
            target = < 0xffffffff >;

            __overlay__ {
                    status = "okay";
                    pinctrl-0 = < 0xffffffff >;
                    pinctrl-names = "default";
                    clocks = < 0xffffffff >;
                    clock-names = "clkin2";
            };
    };
    fragment@1 {
            target = <0x95>;
            __overlay__ {
                            mux {
                                    groups = "pwm_c_x8";
                                    function = "gpio_periphs";
                                    bias-disable;
                                    drive-strength-microamp = <4000>;
                            };
            };
    };

    __fixups__ {
            pwm_cd = "/fragment@0:target:0";
            pwm_c_x8_pins = "/fragment@0/__overlay__:pinctrl-0:0";
            xtal = "/fragment@0/__overlay__:clocks:0";
    };

};

The amlogic documentation is to leak to find the trouble.

Have you an idea to solve the issue ?

Thanks for your work on this amazing board, best regards

Hello

I was quite next to the solution with the overlay, i solve the trouble with:

/dts-v1/;

/ {
compatible = “radxa,zero\0amlogic,g12a”;

    fragment@0 {
            target = < 0xffffffff >;

            __overlay__ {
                    status = "okay";
                    pinctrl-0 = < 0xffffffff >;
                    pinctrl-names = "default";
                    clocks = < 0xffffffff >;
                    clock-names = "clkin2";
            };
    };
    fragment@1 {
            target = <0x95>;
            __overlay__ {
                            mux {
                                    groups = "pwm_c_x8";
                                    function = "pwm_c";
                                    bias-disable;
                                    drive-strength-microamp = <4000>;
                            };
            };
    };

    __fixups__ {
            pwm_cd = "/fragment@0:target:0";
            pwm_c_x8_pins = "/fragment@0/__overlay__:pinctrl-0:0";
            xtal = "/fragment@0/__overlay__:clocks:0";
    };

};

But how can i change GPIO drive strength. I don’t see them in devicetree, only peripherals. I have other board and i suspected this will cause me trouble.

Best regards

Hello
When i try to change GPIOAO_9 drive strength with my own write overlay below:

/dts-v1/;
/plugin/;
/ {
compatible = “radxa,zero”, “amlogic,g12a”;
fragment@0 {
target = <&GPIOAO_9>;
overlay {
mux {
groups = “GPIOAO_9”;
function = “gpio_aobus”;
bias-disable;
drive-strength-microamp = <4000>;
};
};
};
};

I lose the PWM on GPIOAO_11 and GPIOAO_9 is not 4000mA but 500uA

How can I set individual drive strength on ao_bus and periph_bus without modifying PWM overlay ?

Thanks

Help please,

I have ten zero boards, and i need to change some drive strength pins 500µA is to small for my app. I arrive to change this for my two PWM ( see upper post).
But I fail after a lot of search and try to modify drive strength of a single GPIO ( more if i succes) , for example the GPIOAO_9 in the devicetree.
I’m not an expert of devitree, please any advice is welcome
Best regards

Your target should be either pwm_ao_a_pins or pwm_c_x8_pins, then try copy the same structure like this and add drive-strength-microamp.

Hello

Thank for the reply and the link. I was arrive to change pwm drive strength, but my motor controller need also some gpio with “high” current, and i search how to modify that in device tree like my last post, but in some cases I lose PWM on the pwm_ao_a_pins an drive strength not change, and for some try with another overlay i don’t lose the pwm but the drive strength don’t change.
I don’t see were the value of drive strength are define for common Gpio in the link you give.

Thank for your support, best regards

Here is an example of how GPIO’s strength was defined. I’d assume undefined are default to the lowest level of drive strength to save power. Depending on which bank your GPIO pin is located you may need to change function to gpio_aobus. You can check gpio_aobus_groups and gpio_periphs_groups in the last file to see which pin belong to which bank.

As I’m writing this reply it occurs to me that you might have mismatched groups and function in your dtb overlay. So try copy exact section from meson-g12-common.dtsi and add your drive-strength line.

Hello
I try like the forum discussionthere with linuxlion, but like him no change…

So i try to understand what you tell me and i try this 'fragment@03 ( is this really that you want to say ?):

/dts-v1/;

/ {
	compatible = "radxa,zero\0amlogic,g12a";

	fragment@0 {
		target = < 0xffffffff >;

		__overlay__ {
			status = "okay";
			pinctrl-0 = < 0xffffffff >;
			pinctrl-names = "default";
			clocks = < 0xffffffff >;
			clock-names = "clkin3";
		};
	};
        fragment@1 {
                target = "pwm-ao-a";
                __overlay__ {
                                mux {
                                        groups = "pwm_ao_a";
                                        function = "pwm_ao_a";
                                        bias-disable;
                                        drive-strength-microamp = <4000>;
                                };
		};
	};
	fragment@2 {
		target = "gpio_xg";
		__overlay__ {
				mux {
					groups = "GPIOAO_9";
					function = "gpio_aobus";
					bias_disable;
					drive-strength-microamp = <4000>;
				};
                };
        };
	fragment@3 {
                target = "uart-ao-b-tx-8-rx-9";
                __overlay__ {
                                mux {
                                        groups = "uart_ao_b_rx_9";
                                        function = "gpio_aobus";
                                        bias_disable;
                                        drive-strength-microamp = <4000>;
                                };
                };
        };

But same result, no change. So i really don’t know how to change for example GPIOAO_9 drive strength in device tree. If you have a solution, i get it.
I found an other method to change the drive strength. The alternative is to use /dev/mem and busybox (or other mechanism) to write directly to register ( And i hope the S905Y2 have the same register than the S905D3) like that:
`

busybox devmem 0xFF80001c w 0x00CC0000

But I rather the devicetree solution, if you have an idea.
Best regards
`