Libre Computer Wiring Tool

To install via apt:

sudo apt update
sudo apt install libretech-gpio libretech-dtoverlay

libretech-gpio
To get a list of headers for your board:

lgpio headers

To get a list of the header pins for a header:

lgpio header HEADER

For getting the information for a pin number on the main GPIO header of the board:

lgpio info PIN#

For getting the information for a pin number on a specific header of the board:

lgpio info HEADER PIN#

For getting the libgpiod chip and line number for a pin on the main GPIO header of the board:

lgpio info PIN# gpiod

For getting the deprecated sysfs export GPIO number for a pin on the main GPIO header of the board:

lgpio info PIN# sysfs

For conversion from existing Raspberry Pi BCM numbering:

lgpio bcm PIGPIO#

For quickly getting the GPIO level of a specific pin on the main GPIO header of the board:

sudo lgpio get PIN#

For quickly getting the GPIO level of a specific pin on a specific header of the board:

sudo lgpio get HEADER PIN#

For quickly setting the GPIO level of a specific pin on the main GPIO header of the board:

sudo lgpio set PIN#=0 or 1

For quickly setting the GPIO level on multiple pin on the main GPIO header of the board:

sudo lgpio set PIN#=0 or 1 PIN#=0 or 1

For quickly setting the GPIO level of a specific pin on a specific header of the board:

sudo lgpio set HEADER_PIN#=0 or 1

For quickly setting the GPIO level on multiple pin on specific headers of the board:

sudo lgpio set HEADER_PIN#=0 or 1 HEADER_PIN#=0 or 1

We do not recommend using lgpio get or set as an API call since the overhead is high. It also does not support pinctrl biases like gpioget/gpioset commands from the gpiod package does. Please use the libgpiod or sysfs numbers from the lgpio info command with standard libraries for libgpiod or sysfs.

libretech-dtoverlay
List Device Tree Overlays

sudo ldto list

Enable Device Tree Overlays

sudo ldto enable OVERLAY #enable temporarily, not applied on next boot

Disable Device Tree Overlays that were applied temporarily, some hardware overlays cannot be disabled once active and require reboot.

sudo ldto disable OVERLAY #disables temporarily enabled overlays

Merge Device Tree Overlay permanently on every boot, applied on next boot

sudo ldto merge OVERLAY

Remove all permanent Device Tree Overlays, applied on next boot

sudo ldto reset
sudo reboot

You must reboot in order for the system to reset before merging new device trees. Otherwise, the device tree may become corrupted resulting in a system that will fail to boot. In this case, you must remove the dtb folder on the first partition of the storage device.

Overlay Descriptions

Using Upstream Repo for Custom Device Tree Overlay
To install git version:

sudo apt install git
git clone https://github.com/libre-computer-project/libretech-wiring-tool.git
cd libretech-wiring-tool
sudo ./install.sh

To update git version:

cd libretech-wiring-tool
git pull origin master
make

If you have an addon device you would like supported, please post below.

7 Likes
AML-S905X-CC Wiring Tool Overlays Description
C/C++ GPIO library
How to control GPIO via C or Python 3
ROC-RK3328 GPIO Node Red Raspbain
AML-S905X-CC V1 Boosting MicroSD Card Performance with UHS
ROC-RK3328-CC 3.5 inch SPI LCD Touch Screen Display
Le Potato with DHT22
All-h3-cc (h5) uart
UART power /connection from /to another device
AML-S905X-CC Le Potato Overview Resources and Guides
How do I use the GPIO pins in Python
Raspbian 10 Buster for Libre Computer Boards
HDMI redness (youtube)
Recording Audio via SAR ADC
Physical and DRAM base addresses of the S905X ARM SOC
ALL-H3-CC H3/H5 Tritium Overview Resources and Guides
Ldto status does not report "active" overlays
How to activate UART on ALL-H3-CC
2023-09-28 Kernel Recipes and Embedded Recipes Gift Feedback and Support
Python Library for AML-S905X-CC
How to enter Device Mode for USB OTG on USB Type A Port on AML-S905X-CC Le Potato
Libre Computer AML-A311D-CC Alta Overview and Resources
How to control GPIO via C or Python 3
GPIO pins not working
ROC-RK3328-CC (Renegade) Overview Resources and Guides
Libre Computer CC Boards GPIO Pinmux Compatibility Matrix
How to Read and Control PWM Fan Speed on AML-S905X-CC Le Potato
SPI on S805X-AC GPIO header?
AML-S805X-AC La Frite How to Update Board UEFI BIOS Firmware
How to Enable I2C on AML-S905X-CC Le Potato
Raspbian 12 Bookworm and 11 Bullseye for Libre Computer Boards
AML-S905X-CC (Le Potato) 480x320 ILI9486 3.5" SPI Touchscreen Display
How to enable CVBS output in Raspbian
GPIO Pinout Header Maps and Wiring Tool for Libre Computer Boards
Cannot get pins to change state
How to control GPIO via C or Python 3
How to control GPIO via C or Python 3
Cannot get pins to change state
How to create a NFS debugging environment for Libre Computer boards
Connect to DS18D20 sensor
Raspbian 12 Bookworm and 11 Bullseye for Libre Computer Boards
Libre Computer AML-S905D3-CC Solitude Overview Resources and Guides
Klipper ADXL345 Wiring / SPI / UART
ROC-RK3328-CC (Renegade) 480x320 ILI9486 SPI Touchscreen Display
Connect to DS18D20 sensor
Help! Impossible to activate UART / GPIO on AML-S805X-AC (La Frite) Board
How to get into AML-S905X-CC BIOS settings?
Problems accessing MCP3008 via SPI - Invalid argument
Sending PWM signal to pin 8
Wiring Pi or similar for the Le Potato
Porting C based GPIO Programming from Raspian/Raspberry PI OS
Porting C based GPIO Programming from Raspian/Raspberry PI OS
I2C behaving strangely on ALL-H3-CC-H5
Sense hat with potato?
How to Read and Control PWM Fan Speed on AML-S905X-CC Le Potato

This should be set instead of get, correct?

1 Like

Fixed in the documentation. Thanks for pointing out the typo.

Does this tool work on armbian? I keep getting “No vendor found!” message

This is designed for first party images only.

Hello! Thanks for putting this information together.

I have a Le Potato 64bit running 2022-09-22-raspbian-bullseye-arm64+aml-s905x-cc.img.xz.

When following these instructions, I am able to do some of the commands but the “get” and “set” commands do not work.

For example,
sudo lgpio get 7J1 3
results in
gpioget: symbol lookup error: gpioget: undefined symbol: gpiod_is_gpiochip_device

I am struggling to find a resolution to this. Please let me know if you have any ideas. Thanks!

Just tried this on the lite image and it worked fine. Did you modify the image in any way or try to install something beforehand?

Thanks for the reply and testing it!

I was testing other GPIO libraries such as (ArmbianIO

That may have interfered with this? I didn’t change anything with the Raspbian image either.

I did find in this website’s forums a link to this Working Python GPIO library This has been working for me using python on the le potato!

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.