Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7619

Device Tree • Re: Using an overlay to send a clock signal to a GPIO pin.

$
0
0
No - ideally you just make use of an existing driver, which in the case of GPCLK would be the clock driver - "bcm2711-cprman" on Pi 4 or "rp1-clk" on Pi 5.
Okay thank you, I'll have a look :)
I've had a look and I tried to write an overlay for the Pi 5 using rp1-clk, here is my attempt:

Code:

/dts-v1/;/plugin/;/ {    compatible = "brcm,bcm2712";    fragment@0 {        target = <&rp1_clocks>;        __overlay__ {            assigned-clocks = <&rp1_clocks 33>;   // RP1_CLK_GP0            assigned-clock-parents = <&clk_xosc>; // 24MHz oscillator            assigned-clock-rates = <12288000>;    // 12.288 MHz        };    };    fragment@1 {        target = <&rp1_gpio>;        __overlay__ {            gpclk0_pin: gpclk0_pin {                brcm,pins = <4>;     // GPIO4 / Pin 7                brcm,function = <4>; // ALT0  / GPCLK0            };        };    };};
However, pinctrl shows GPIO4 = none and I'm not getting a clock on the pin, instead it is just hi. /sys/kernel/debug/clk/clk_gp0/clk_rate is 50000000 too.

I'm not all that familiar with device tree overlays as I've only been working with them for about a week, some pointers would be appreciated :D

Statistics: Posted by petercs — Wed Jun 25, 2025 9:38 am



Viewing all articles
Browse latest Browse all 7619

Trending Articles