Libre Computer Wiring Tool

The default Debian gpioget and gpioset definitely works. You probably modified something on the image and removed a library or something.

The official package is python3-libgpiod: Debian -- Details of package python3-libgpiod in bullseye
It is maintained by upstream and already integrated into Debian and derivatives proper.

Probably, I am very new to the Le Potato and only so-so on the Raspberry Pi. Appreciate the help!

1 Like

Hello. I’m trying to get a GPS module to work with Le Potato.
I’m running Raspbian 6.0.11.
I was able to get uarta connected to the GPS module using the ldto tool.
sudo ./ldto enable uarta
sudo ./ldto merge uarta
The serial ports on GPIO pins 8/10 show up as /dev/ttyAML6
This is now referenced in the /etc/default/gpsd.
DEVICES="/dev/ttyAML6 /dev/pps0"
Using the gpsmon tool, the NMEA sentences are displayed correctly.
I am trying to connect a GPIO pin for the PPS input.
In the Raspberry Pi version, this connection is added in the /boot/config.txt
dtoverlay=pps-gpio,gpiopin=12
I would like to use pin 12 of the 7J1 connector for the PPS input.
How can I connect this GPIO pin to the gpsd daemon?
thanks

You have to clone the wiring tool repo, write an device tree overlay for that specific pin, and then enable/merge it. Then it should work. PPS GPIO is already enabled in the kernel.

hi I’m a little lost trying to get used to using the s905x-cc. i have several python codes that i used to run on the raspberry pi that i would like to run on the s905x-cc, but I’m lost at what code/ library i need to use in python3 to control the GPIO pins.
should i start here with this wiring tool or if there is documentation that i can be pointed to so as i can get answers. thanks in advance

We will write a guide for this because you are not the first one to ask. It will be here: WIP: How to control GPIO via Python 3

It should get completed in the next two or three days.

2 Likes

Can i get help with a dtsoverlay to enable OTG for HID (keyboard/mouse)? Does this look correct?

/dts-v1/;
/plugin/;

/ {
        compatible = "libretech,cc", "amlogic,s905x", "amlogic,meson-gxl";
        part-number = "s905x-cc-otg";

        fragment@0 {
                target = <&usb_otg>;

                __overlay__ {
                        dr_mode = "otg";
                };
        };
 };

You can find the DT here: https://boot.libre.computer/ci/aml-s905x-cc.dts

The part-number and target are both incorrect.

https://wiki.st.com/stm32mpu/wiki/OTG_device_tree_configuration#DT_configuration_example_as_high-speed_OTG_in_Host_or_Peripheral_mode-2C_with_micro-B_or_Type-C_connector-2C_and_with_VBUS_and_ID_left_unconnected

Thank you for this information. Does this look correct?
/dts-v1/;
/plugin/;

/ {
compatible = “libretech,cc”, “amlogic,s905x”, “amlogic,meson-gxl-usb-ctrl”;

    fragment@0 {
            target = <&dwc2>;

            __overlay__ {
                    dr_mode = "otg";
                    status = "okay";
            };
    };

};

I recommend you open a new thread about this so that it’s searchable. The USB tree is a little complex and I don’t think that’s right.

		usb = "/soc/usb@d0078080";
		dwc2 = "/soc/usb@d0078080/usb@c9100000";
		dwc3 = "/soc/usb@d0078080/usb@c9000000";

I think usb@c9100000 is the device in question. You have to read more on the Linux documentation about the dwc2 driver.

I keep seeing the “No vendor found!” error as well. I am running an image I downloaded from https://libre.computer/products/aml-s905x-cc/ > Downloads > Armbian.

If that’s not “first party,” can you clarify what a “first-party image” is?

Is there a way to enable and control PWM on Armbian without ldto?

Armbian does not support our tooling. First party images are those found on distro.libre.computer.

Following line is a bit misleading, I would add # before temporarily.

sudo ldto enable OVERLAY temporarily
1 Like

Fixed the typo on that line.

I am getting some weird results while running these commands (on a potato running ubuntu 22.04.1 server). I have a setup with an LED hooked up to the main GPIO header pins to see the results. The set commands work as expected, I am able to set the pin to high and low and observe the expected on and off of the LED. So setting the pin level manually seems to be fine.

However, when I try to get the status of the pin after changing it (since I want to read button presses using the GPIO pins), the status always comes back as high (1), even when I have just set it to be low (0).
So I get results like this:

$ sudo lgpio set 40=0
$ sudo lgpio get 40
1

The other interesting thing is that when I do this with my LED that is hooked up to the GPIO pin whose state I am changing, when I set the pin to 0 the LED goes completely off, but when I do the get on the pin the LED comes on just ever so faintly. So it seems like the get does actually change the state of the pin (I had no idea this was a quantum computer!) which might be why it always returns high.

I have tried this with both lgpio and gpioset and get the same results. Any idea how to properly read the state?

GPIO set is output mode. GPIO get is input mode. Your understanding of GPIOs is incorrect.

You keep track of your own pin state.

@librecomputer I have two probably very basic questions about the device tree on a ROC-RK3328-CC, which I didn’t think deserved their own thread, but happy to make one.

  1. The Raspian image for ROC-RK3328-CC (as best I can tell) ships with all of the PWM nodes disabled. What’s the purpose/benefit of having available hardware disabled by default? For example, does it save power or resources? Increase security? I’ve been reading a lot about device trees over the last couple of days, and haven’t found a good explanation for this, even though it seems fairly common across many boards and devices.

  2. Ultimately (I think), the DT nodes need to get very specific about actual hardware characteristics of the SOC or board; something like a memory address. Having read through the datasheets for the ROC-RK3328-CC, the RK3328, etc, I see a lot of useful information about the hardware, but I haven’t been able to find the specific hardware values present in the DTB. How would someone creating the device tree for a chip or board from scratch know or find those values, if they aren’t provided in the reference material?

  1. A single pin can have multiple hardware functions outside of a simple GPIO. The hardware functions must be enabled and disabled according to the application needs for that GPIO.
  2. Reference existing overlays. This is covered in kernel documentation. Each board vendor can have different implementation.

Hello, is there a simple guide somewhere on how to set outputs or query inputs in NODE-RED on the AML-905X-CC?
I tried to install “node-red-contrib-libgpiod” or “node-red-contrib-roadrunner” without success. I can’t find any “gpio-in” or “gpio_out” nodes. Please help

Does this tool have any sort of mechanism for driving the GPIOCLK_0 through one of the SoC’s PLLs? On the Pi this can be done with the WiringPi tool, as follows:

gpio mode 7 clock ; gpio clock 7 1000000

To output a roughtly 1MHz clock. Reading through the S905X datasheet I see that there are registers for driving this pin. At the very least I would like to be able to set gpioCLK_0_xtal to 1 on the HHI_XTAL_DIVN_CNTL register in order to measure overall system clock performance via an external frequency counter.