Jump to content

Recommended Posts

Posted

Hello, I'm new to this world of SBC. I'm trying to learn as much as possible, and I realize maybe I should have started with a better documented board like the rPI. I guess I just like learning the hard way.

 

I'm trying to use the GPIO pins on the board. Starting with baby steps, I'm looking to just simply turn on/off an LED via GPIO. I've been searching and poking around the /sys filesystem to try to understand how this works, but I'm having a hard time understanding which pins to expose via the export file, and what physical pins those map to.

 

I see /sys/class/gpio/ has two chips, 0 and 10. I see gpiochip0 has 10 pins, and gpiochip10 has 101. Is there a document which maps which of these corresponds to the physical pins available? If I write "8" to the export file /sys/class/gpio/export, does that expose pin 8 on the board (UART_A_TX)? Am I understanding this right or am I way off? For my purpose, which pin would be the right one to start with to turn an LED on?

 

Side note: I also noticed on the schematic for the board that several of the pins are labelled WIFI, are these interface pins for the SOC wifi module? 

 

Apologies if these are dumb questions. I'm just trying to find the info to learn what does what on this board.

Posted

Hi Chris,

 

While learning with a RPi might be easier you get stuck into their environment, but once you understood ARM SoC per se you gain much more. Have you ever done some programming?

 

About the armbianIO:

There is @Larry Bank who saw the lack of a global GPIO software and wrote common C library to access the I2C, SPI and GPIOs of all supported boards : https://forum.armbian.com/topic/5655-armbianio-api-proposal/

Along came @sgjava who added a Python and Java binding, now you can make use of three languages to talk to your GPIO's

 

sysfs is past, welcome to the future...

Build libgpiod the "New GPIO Interface for User Space"

https://forum.armbian.com/topic/6249-build-libgpiod-the-new-gpio-interface-for-user-space/?

 

You can dump the debugfs gpio file in : /sys/kernel/debug/gpio to get the relationship between numbers and GPIO line name.

 

Wiki over at LibreComputer - it might need some structure first..  http://wiki.loverpi.com/sbc-brand:libre-computer  but I am sure others will be grateful to get some hints how to make use of their libre board

 

Last but not least, I wrote a little Google-Doc with a show case with 3-color LED - see in my signature

Posted

Hello,

 

Thank you for the info. I'll work on getting network set up on my board so I can install these libraries. I was just working with sysfs because it was already present and I wanted to understand at the lower level how to communicate with the GPIO pins. I don't see the Potato listed as a supported board on the armbianIO page, but I'll check that out.

 

Yes, I've done programming for years down to some assembly and C, and was intending on writing C apps to handle my projects. Just trying to understand how it works at the bottom-most layer. I'm working towards being able to use flashrom and a pomona clip with this board eventually.

 

The wiki for these boards is very incomplete. I've read all of that stuff, but mostly I just look over the schematic to understand what pins are what on this thing. I just didn't understand the relationships between what I found in sysfs and what I saw on the board.

 

Thanks again!

Posted

So, I have installed libgpiod and can run the gpioinfo and all that. I'm just still not sure how these pins map to the physical pins.  sysfs/debug isn't much help either, same info as what's in gpioinfo. It's only listing 6 pins.

chris@lepotato:~/Projects/libgpiod$ sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-9, parent: platform/c8100000.aobus:pinctrl@14, aobus-banks:
 gpio-2   (                    |librecomputer:blue  ) out lo    
 gpio-3   (                    |?                   ) out lo    

gpiochip1: GPIOs 10-110, parent: platform/c8834000.periphs:pinctrl@4b0, periphs-banks:
 gpio-29  (                    |HDMI_5V             ) out lo    
 gpio-45  (                    |reset               ) out lo    
 gpio-58  (                    |cd                  ) in  lo    
 gpio-83  (                    |librecomputer:system) out hi 

 

 

I'm sorry if I'm just being a pain here or something, but I am not following where I'm supposed to find the info on which line in gpioinfo I need to activate to make, for example, pin 14 on the header go high. There's a 100 pins listed on gpiochip1. If there's another document I need to reference to derive the pins, that's fine. I just need to know how one goes about determining which pin in software corresponds to the hardware header.

Posted

This is something I haven't quite figured out either.  The potato device tree assigned a user-friendly name to each pin, however for the life of me I can't find it in the device listing.  

Posted

I cannot remember how I did it, but as I called it 'merge' I must have collected it from different sources, like sysfs & device tree. I think even Tony gave me that tipp.

Attached a LibreOffice spreadsheet with 3 sheets in it,  'merge' is the one you are looking for

GPIO Pins.ods

Posted

Yes, the device tree has a comma delimited table in it with the names, but that means they should exist in the kernel somewhere, I haven't spent enough time trying to find them.  Maybe I should just ask @Neil Armstrong to fill in for my lack of knowledge whenever he has a free moment.  (Obviously he is quite busy doing the real work, so don't expect anything/anything soon)

Posted
1 hour ago, TonyMac32 said:

Yes, the device tree has a comma delimited table in it with the names, but that means they should exist in the kernel somewhere, I haven't spent enough time trying to find them. 

If you are talking about the "gpio-line-names" property AFAIK it just lists all the pin names in their numeric order (with a lot of empty strings for pins that are not routed anywhere).

Posted

These names should be printed in the /sys/kernel/début/gpio if not there must be a mismatch in the number of entries.

 

can you dump the dmesg somewhere ?

 

Here is a sheet of all the pins exported by the potato board https://docs.google.com/spreadsheets/d/1uu09Fp14bJ9YhlEIYVn5R430V4p-v6A4SsAgdEem9EI

 

To know the gpio number, the first bank with 10 gpios is the AO bank from GPIOAO_0 to 9.

the second bank mapping can be found in the kernel header : https://github.com/torvalds/linux/blob/master/include/dt-bindings/gpio/meson-gxl-gpio.h

Posted
If you are talking about the "gpio-line-names" property AFAIK it just lists all the pin names in their numeric order (with a lot of empty strings for pins that are not routed anywhere).
Right. I just couldn't find the entries, truthfully I wasn't certain where to look. Thanks Neil for giving direction so quickly. I'll take a look after bit, at the moment installing curtains for the wife... ;-)

Sent from my Pixel using Tapatalk

Posted

@Neil Armstrong

 

I get

gpiochip0: GPIOs 0-9, parent: platform/c8100000.aobus:pinctrl@14, aobus-banks:
 gpio-2   (                    |librecomputer:blue  ) out lo
 gpio-3   (                    |?                   ) out lo

gpiochip1: GPIOs 10-110, parent: platform/c8834000.periphs:pinctrl@4b0, periphs-banks:
 gpio-29  (                    |HDMI_5V             ) out lo
 gpio-45  (                    |reset               ) out lo
 gpio-58  (                    |cd                  ) in  lo
 gpio-83  (                    |librecomputer:system) out hi

from/sys/kernel/debug/gpio

 

Spoiler

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.17-meson64 (root@builder) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #54 SMP PREEMPT Sun Feb 4 02:04:19 EST 2018
[    0.000000] Boot CPU: AArch64 Processor [410fd034]
[    0.000000] Machine model: Libre Technology CC
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x000000006c400000, size 188 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] On node 0 totalpages: 486144
[    0.000000]   DMA zone: 7616 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 486144 pages, LIFO batch:31
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv0.2 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: Trusted OS migration not required
[    0.000000] random: fast init done
[    0.000000] percpu: Embedded 21 pages/cpu @ffff80006c375000 s47640 r8192 d30184 u86016
[    0.000000] pcpu-alloc: s47640 r8192 d30184 u86016 alloc=21*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: enabling workaround for ARM erratum 845719
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 478528
[    0.000000] Kernel command line: root=/dev/mmcblk1p1 rootwait rootflags=data=writeback rw rootfstype=ext4 console=ttyAML0,115200n8 no_console_suspend consoleblank=0 fsck.repair=yes loglevel=5 net.ifnames=0
[    0.000000] log_buf_len individual max cpu contribution: 4096 bytes
[    0.000000] log_buf_len total cpu_extra contributions: 12288 bytes
[    0.000000] log_buf_len min size: 16384 bytes
[    0.000000] log_buf_len: 32768 bytes
[    0.000000] early log buf free: 14500(88%)
[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
[    0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.000000] Memory: 1696464K/1944576K available (8828K kernel code, 712K rwdata, 3180K rodata, 576K init, 290K bss, 55600K reserved, 192512K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     modules : 0xffff000000000000 - 0xffff000008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffff000008000000 - 0xffff7dffbfff0000   (129022 GB)
[    0.000000]       .text : 0xffff000008080000 - 0xffff000008920000   (  8832 KB)
[    0.000000]     .rodata : 0xffff000008920000 - 0xffff000008c40000   (  3200 KB)
[    0.000000]       .init : 0xffff000008c40000 - 0xffff000008cd0000   (   576 KB)
[    0.000000]       .data : 0xffff000008cd0000 - 0xffff000008d82200   (   713 KB)
[    0.000000]        .bss : 0xffff000008d82200 - 0xffff000008dcad20   (   291 KB)
[    0.000000]     fixed   : 0xffff7dfffe7fd000 - 0xffff7dfffec00000   (  4108 KB)
[    0.000000]     PCI I/O : 0xffff7dfffee00000 - 0xffff7dffffe00000   (    16 MB)
[    0.000000]     vmemmap : 0xffff7e0000000000 - 0xffff800000000000   (  2048 GB maximum)
[    0.000000]               0xffff7e0000040000 - 0xffff7e0001e00000   (    29 MB actual)
[    0.000000]     memory  : 0xffff800001000000 - 0xffff800078000000   (  1904 MB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=4.
[    0.000000]  Tasks RCU enabled.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000003] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.000338] Console: colour dummy device 80x25
[    0.000356] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=96000)
[    0.000363] pid_max: default: 32768 minimum: 301
[    0.000426] Security Framework initialized
[    0.000467] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000479] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.016009] ASID allocator initialised with 65536 entries
[    0.023995] Hierarchical SRCU implementation.
[    0.032306] EFI services will not be available.
[    0.040033] smp: Bringing up secondary CPUs ...
[    0.068224] Detected VIPT I-cache on CPU1
[    0.068268] CPU1: Booted secondary processor [410fd034]
[    0.096255] Detected VIPT I-cache on CPU2
[    0.096288] CPU2: Booted secondary processor [410fd034]
[    0.124292] Detected VIPT I-cache on CPU3
[    0.124323] CPU3: Booted secondary processor [410fd034]
[    0.124382] smp: Brought up 1 node, 4 CPUs
[    0.124386] SMP: Total of 4 processors activated.
[    0.124390] CPU features: detected feature: 32-bit EL0 Support
[    0.124505] CPU: All CPU(s) started at EL2
[    0.124522] alternatives: patching kernel code
[    0.125040] devtmpfs: initialized
[    0.128864] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.128877] futex hash table entries: 1024 (order: 5, 131072 bytes)
[    0.133205] pinctrl core: initialized pinctrl subsystem
[    0.133742] DMI not present or invalid.
[    0.133952] NET: Registered protocol family 16
[    0.134888] cpuidle: using governor menu
[    0.135497] vdso: 2 pages (1 code @ ffff000008926000, 1 data @ ffff000008cd5000)
[    0.135507] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.137297] DMA: preallocated 2048 KiB pool for atomic allocations
[    0.137404] Serial: AMBA PL011 UART driver
[    0.146722] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.147467] ACPI: Interpreter disabled.
[    0.148383] SCSI subsystem initialized
[    0.148538] libata version 3.00 loaded.
[    0.148688] usbcore: registered new interface driver usbfs
[    0.148714] usbcore: registered new interface driver hub
[    0.148762] usbcore: registered new device driver usb
[    0.148949] pps_core: LinuxPPS API ver. 1 registered
[    0.148952] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.148961] PTP clock support registered
[    0.149022] dmi: Firmware registration failed.
[    0.149226] Advanced Linux Sound Architecture Driver Initialized.
[    0.149848] clocksource: Switched to clocksource arch_sys_counter
[    0.149956] VFS: Disk quotas dquot_6.6.0
[    0.149999] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.150100] pnp: PnP ACPI: disabled
[    0.154282] NET: Registered protocol family 2
[    0.154632] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[    0.154736] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[    0.154929] TCP: Hash tables configured (established 16384 bind 16384)
[    0.155016] UDP hash table entries: 1024 (order: 3, 32768 bytes)
[    0.155054] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
[    0.155200] NET: Registered protocol family 1
[    0.155491] RPC: Registered named UNIX socket transport module.
[    0.155494] RPC: Registered udp transport module.
[    0.155496] RPC: Registered tcp transport module.
[    0.155498] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.155506] PCI: CLS 0 bytes, default 128
[    0.155638] Unpacking initramfs...
[    0.377927] Freeing initrd memory: 5472K
[    0.378598] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    0.378827] kvm [1]: 8-bit VMID
[    0.378830] kvm [1]: IDMAP page: 1916000
[    0.378832] kvm [1]: HYP VA range: 800000000000:ffffffffffff
[    0.379332] kvm [1]: vgic-v2@c4304000
[    0.379385] kvm [1]: vgic interrupt IRQ1
[    0.379394] kvm [1]: virtual timer IRQ4
[    0.379452] kvm [1]: Hyp mode initialized successfully
[    0.380954] audit: initializing netlink subsys (disabled)
[    0.381070] audit: type=2000 audit(0.376:1): state=initialized audit_enabled=0 res=1
[    0.381330] workingset: timestamp_bits=46 max_order=19 bucket_order=0
[    0.386087] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.386594] NFS: Registering the id_resolver key type
[    0.386612] Key type id_resolver registered
[    0.386614] Key type id_legacy registered
[    0.386622] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.386745] 9p: Installing v9fs 9p2000 file system support
[    0.387056] aufs 4.13-20171030
[    0.389118] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)
[    0.389207] io scheduler noop registered
[    0.389362] io scheduler cfq registered (default)
[    0.389366] io scheduler mq-deadline registered
[    0.389368] io scheduler kyber registered
[    0.393463] soc soc0: Amlogic Meson GXL (S905X) Revision 21:b (82:2) Detected
[    0.393731] meson_gx_pwrc_vpu c8100000.sys-ctrl:power-controller-vpu: failed to get reset lines
[    0.395950] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.397047] c81004c0.serial: ttyAML0 at MMIO 0xc81004c0 (irq = 12, base_baud = 1500000) is a meson_uart
[    0.404545] console [ttyAML0] enabled
[    0.410142] loop: module loaded
[    0.411421] mdio-mux-mmioreg c883455c.eth-phy-mux: failed to register mdio-mux bus /soc/periphs@c8834000/eth-phy-mux
[    0.416566] libphy: Fixed MDIO Bus: probed
[    0.416741] tun: Universal TUN/TAP device driver, 1.6
[    0.417349] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    0.417351] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    0.417382] igb: Intel(R) Gigabit Ethernet Network Driver - version 5.4.0-k
[    0.417384] igb: Copyright (c) 2007-2014 Intel Corporation.
[    0.417409] igbvf: Intel(R) Gigabit Virtual Function Network Driver - version 2.4.0-k
[    0.417411] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    0.417435] sky2: driver version 1.30
[    0.417662] VFIO - User Level meta-driver version: 0.3
[    0.418411] dwc3 c9000000.usb: failed to initialize core
[    0.421981] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.421984] ehci-pci: EHCI PCI platform driver
[    0.422030] ehci-platform: EHCI generic platform driver
[    0.422113] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.422137] ohci-pci: OHCI PCI platform driver
[    0.422177] ohci-platform: OHCI generic platform driver
[    0.422443] usbcore: registered new interface driver usb-storage
[    0.423292] mousedev: PS/2 mouse device common for all mice
[    0.423587] i2c /dev entries driver
[    0.423869] IR NEC protocol handler initialized
[    0.423872] IR RC5(x/sz) protocol handler initialized
[    0.423874] IR RC6 protocol handler initialized
[    0.423876] IR JVC protocol handler initialized
[    0.423878] IR Sony protocol handler initialized
[    0.423880] IR SANYO protocol handler initialized
[    0.423883] IR Sharp protocol handler initialized
[    0.423885] IR MCE Keyboard/mouse protocol handler initialized
[    0.423887] IR XMP protocol handler initialized
[    0.426970] Registered IR keymap rc-empty
[    0.427060] rc rc0: meson-ir as /devices/platform/soc/c8100000.aobus/c8100580.ir/rc/rc0
[    0.427149] input: meson-ir as /devices/platform/soc/c8100000.aobus/c8100580.ir/rc/rc0/input0
[    0.427441] input: MCE IR Keyboard/Mouse (meson-ir) as /devices/virtual/input/input1
[    0.427618] meson-ir c8100580.ir: receiver initialized
[    0.428389] sdhci: Secure Digital Host Controller Interface driver
[    0.428392] sdhci: Copyright(c) Pierre Ossman
[    0.428441] Synopsys Designware Multimedia Card Interface Driver
[    0.429459] meson-gx-mmc d0074000.mmc: allocated mmc-pwrseq
[    0.470274] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.474698] ledtrig-cpu: registered to indicate activity on CPUs
[    0.474986] meson-gx-mmc d0074000.mmc: no support for card's volts
[    0.475084] meson-sm: secure-monitor enabled
[    0.475431] usbcore: registered new interface driver usbhid
[    0.475433] usbhid: USB HID core driver
[    0.475517] mmc0: error -22 whilst initialising SDIO card
[    0.475596] platform-mhu c883c404.mailbox: Platform MHU Mailbox registered
[    0.478210] meson-audio-core c1105400.audio: Failed to create debugfs directory
[    0.480273] NET: Registered protocol family 10
[    0.490207] meson-gx-mmc d0074000.mmc: no support for card's volts
[    0.493756] Segment Routing with IPv6
[    0.493832] NET: Registered protocol family 17
[    0.493950] 9pnet: Installing 9P2000 support
[    0.494038] Key type dns_resolver registered
[    0.494250] mmc0: error -22 whilst initialising MMC card
[    0.494691] registered taskstats version 1
[    0.497638] zswap: default zpool zbud not available
[    0.497643] zswap: pool creation failed
[    0.509388] mdio-mux-mmioreg c883455c.eth-phy-mux: failed to register mdio-mux bus /soc/periphs@c8834000/eth-phy-mux
[    0.519229] dwc3 c9000000.usb: failed to initialize core
[    0.524628] meson-gx-mmc d0072000.mmc: Got CD GPIO
[    0.562420] scpi_protocol scpi: SCP Protocol 0.0 Firmware 0.0.0 version
[    0.568272] cpu cpu0: bL_cpufreq_init: CPU 0 initialized
[    0.568348] arm_big_little: bL_cpufreq_register: Registered platform driver: scpi
[    0.569509] mdio-mux-mmioreg c883455c.eth-phy-mux: failed to register mdio-mux bus /soc/periphs@c8834000/eth-phy-mux
[    0.575194] dwc3 c9000000.usb: failed to initialize core
[    0.580143] hctosys: unable to open rtc device (rtc0)
[    0.580291] VDDIO_BOOT: disabling
[    0.580294] HDMI_5V: disabling
[    0.580297] ALSA device list:
[    0.580299]   No soundcards found.
[    0.585446] Freeing unused kernel memory: 576K
[    0.617347] mmc1: new SDHC card at address aaaa
[    0.618029] mmcblk1: mmc1:aaaa SE32G 29.7 GiB
[    0.619477]  mmcblk1: p1
[    0.621000] mdio-mux-mmioreg c883455c.eth-phy-mux: failed to register mdio-mux bus /soc/periphs@c8834000/eth-phy-mux
[    0.626884] dwc3 c9000000.usb: failed to initialize core
[    0.803117] meson8b-dwmac c9410000.ethernet: PTP uses main clock
[    0.803488] meson8b-dwmac c9410000.ethernet: no reset control found
[    0.803836] stmmac - user ID: 0x11, Synopsys ID: 0x37
[    0.803844] meson8b-dwmac c9410000.ethernet: Ring mode enabled
[    0.803848] meson8b-dwmac c9410000.ethernet: DMA HW capability register supported
[    0.803852] meson8b-dwmac c9410000.ethernet: Normal descriptors
[    0.803855] meson8b-dwmac c9410000.ethernet: RX Checksum Offload Engine supported
[    0.803858] meson8b-dwmac c9410000.ethernet: COE Type 2
[    0.803861] meson8b-dwmac c9410000.ethernet: TX Checksum insertion supported
[    0.803864] meson8b-dwmac c9410000.ethernet: Wake-Up On Lan supported
[    0.803895] meson8b-dwmac c9410000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    0.803957] mdio-mux-mmioreg c883455c.eth-phy-mux: failed to register mdio-mux bus /soc/periphs@c8834000/eth-phy-mux
[    0.804000] libphy: stmmac: probed
[    0.815842] meson-drm d0100000.vpu: Queued 3 outputs on vpu
[    0.817262] meson-drm d0100000.vpu: Failed to create debugfs directory
[    0.818986] xhci-hcd xhci-hcd.4.auto: xHCI Host Controller
[    0.819031] xhci-hcd xhci-hcd.4.auto: new USB bus registered, assigned bus number 1
[    0.820559] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    0.820562] [drm] No driver support for vblank timestamp query.
[    0.820887] xhci-hcd xhci-hcd.4.auto: hcc params 0x0228f664 hci version 0x100 quirks 0x02010010
[    0.820931] xhci-hcd xhci-hcd.4.auto: irq 32, io mem 0xc9000000
[    0.821064] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    0.821070] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.821073] usb usb1: Product: xHCI Host Controller
[    0.821076] usb usb1: Manufacturer: Linux 4.14.17-meson64 xhci-hcd
[    0.821079] usb usb1: SerialNumber: xhci-hcd.4.auto
[    0.821508] hub 1-0:1.0: USB hub found
[    0.821545] hub 1-0:1.0: 2 ports detected
[    0.821831] xhci-hcd xhci-hcd.4.auto: xHCI Host Controller
[    0.821886] xhci-hcd xhci-hcd.4.auto: new USB bus registered, assigned bus number 2
[    0.821969] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    0.822046] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
[    0.822050] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.822054] usb usb2: Product: xHCI Host Controller
[    0.822057] usb usb2: Manufacturer: Linux 4.14.17-meson64 xhci-hcd
[    0.822060] usb usb2: SerialNumber: xhci-hcd.4.auto
[    0.822509] hub 2-0:1.0: USB hub found
[    0.822544] hub 2-0:1.0: config failed, hub doesn't have any ports! (err -19)
[    0.828514] libphy: mdio_mux: probed
[    0.832095] libphy: mdio_mux: probed
[    0.846005] meson-dw-hdmi c883a000.hdmi-tx: Detected HDMI TX controller v2.01a with HDCP (meson_dw_hdmi_phy)
[    0.846956] meson-dw-hdmi c883a000.hdmi-tx: registered DesignWare HDMI I2C bus driver
[    0.847370] meson-drm d0100000.vpu: bound c883a000.hdmi-tx (ops meson_dw_hdmi_ops [meson_dw_hdmi])
[    0.906588] [drm] kms: can't enable cloning when we probably wanted to.
[    1.074785] Console: switching to colour frame buffer device 240x67
[    1.123903] meson-drm d0100000.vpu: fb0:  frame buffer device
[    1.138504] [drm] Initialized meson 1.0.0 20161109 for d0100000.vpu on minor 0
[    1.153906] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[    1.241957] raid6: int64x1  gen()   340 MB/s
[    1.309881] raid6: int64x1  xor()   310 MB/s
[    1.331137] usb 1-1: New USB device found, idVendor=05e3, idProduct=0610
[    1.331142] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[    1.331146] usb 1-1: Product: USB2.0 Hub
[    1.377877] raid6: int64x2  gen()   727 MB/s
[    1.445882] raid6: int64x2  xor()   556 MB/s
[    1.462330] hub 1-1:1.0: USB hub found
[    1.462624] hub 1-1:1.0: 4 ports detected
[    1.513901] raid6: int64x4  gen()  1210 MB/s
[    1.581883] raid6: int64x4  xor()   848 MB/s
[    1.649900] raid6: int64x8  gen()  1166 MB/s
[    1.717882] raid6: int64x8  xor()   879 MB/s
[    1.785878] raid6: neonx1   gen()   741 MB/s
[    1.797863] usb 1-1.1: new full-speed USB device number 3 using xhci-hcd
[    1.853894] raid6: neonx1   xor()   694 MB/s
[    1.900521] usb 1-1.1: New USB device found, idVendor=04f2, idProduct=0976
[    1.900526] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    1.900530] usb 1-1.1: Product: Wireless Device
[    1.900533] usb 1-1.1: Manufacturer: Chicony
[    1.912249] input: Chicony Wireless Device as /devices/platform/soc/c9000000.usb/xhci-hcd.4.auto/usb1/1-1/1-1.1/1-1.1:1.0/0003:04F2:0976.0001/input/input2
[    1.921868] raid6: neonx2   gen()  1308 MB/s
[    1.989857] raid6: neonx2   xor()  1230 MB/s
[    1.990240] hid-generic 0003:04F2:0976.0001: input: USB HID v1.11 Keyboard [Chicony Wireless Device] on usb-xhci-hcd.4.auto-1.1/input0
[    1.993261] input: Chicony Wireless Device as /devices/platform/soc/c9000000.usb/xhci-hcd.4.auto/usb1/1-1/1-1.1/1-1.1:1.1/0003:04F2:0976.0002/input/input3
[    2.050063] hid-generic 0003:04F2:0976.0002: input: USB HID v1.11 Device [Chicony Wireless Device] on usb-xhci-hcd.4.auto-1.1/input1
[    2.052210] input: Chicony Wireless Device as /devices/platform/soc/c9000000.usb/xhci-hcd.4.auto/usb1/1-1/1-1.1/1-1.1:1.2/0003:04F2:0976.0003/input/input4
[    2.052465] hid-generic 0003:04F2:0976.0003: input: USB HID v1.11 Mouse [Chicony Wireless Device] on usb-xhci-hcd.4.auto-1.1/input2
[    2.057978] raid6: neonx4   gen()  1823 MB/s
[    2.125881] raid6: neonx4   xor()  1689 MB/s
[    2.193898] raid6: neonx8   gen()  1939 MB/s
[    2.199817] [drm] kms: can't enable cloning when we probably wanted to.
[    2.261864] raid6: neonx8   xor()  1766 MB/s
[    2.261867] raid6: using algorithm neonx8 gen() 1939 MB/s
[    2.261869] raid6: .... xor() 1766 MB/s, rmw enabled
[    2.261871] raid6: using neon recovery algorithm
[    2.265298] xor: measuring software checksum speed
[    2.301862]    8regs     :  2716.000 MB/sec
[    2.341858]    8regs_prefetch:  2419.000 MB/sec
[    2.381850]    32regs    :  3337.000 MB/sec
[    2.421849]    32regs_prefetch:  2805.000 MB/sec
[    2.421852] xor: using function: 32regs (3337.000 MB/sec)
[    2.429427] Btrfs loaded, crc32c=crc32c-generic
[    7.936871] EXT4-fs (mmcblk1p1): mounted filesystem with writeback data mode. Opts: data=writeback
[    8.652893] systemd[1]: System time before build time, advancing clock.
[    8.696356] systemd[1]: systemd 229 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN)
[    8.696919] systemd[1]: Detected architecture arm64.
[    8.725618] systemd[1]: Set hostname to <lepotato>.
[    9.324659] systemd[1]: Listening on Journal Socket (/dev/log).
[    9.334201] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[    9.349467] systemd[1]: Created slice User and Session Slice.
[    9.363433] systemd[1]: Reached target Swap.
[    9.374755] systemd[1]: Started Trigger resolvconf update for networkd DNS.
[    9.386806] systemd[1]: Listening on udev Control Socket.
[    9.398612] systemd[1]: Listening on fsck to fsckd communication Socket.
[    9.756315] EXT4-fs (mmcblk1p1): re-mounted. Opts: commit=600,errors=remount-ro
[   11.470279] asoc-simple-card sound: i2s-hifi <-> meson-i2s-dai.0.auto mapping ok
[   11.470302] asoc-simple-card sound: ASoC: no DMI vendor name!
[   16.225453] systemd[1]: Started Armbian enhanced Log2Ram.
[   16.244982] systemd[1]: Starting Journal Service...
[   16.323570] systemd[1]: Started Journal Service.
[   16.409040] systemd-journald[499]: Received request to flush runtime journal from PID 1
[   16.853731] zram: Added device: zram0
[   16.854607] zram: Added device: zram1
[   16.857387] zram: Added device: zram2
[   16.859742] zram: Added device: zram3
[   16.933616] zram0: detected capacity change from 0 to 242565120
[   17.475867] meson8b-dwmac c9410000.ethernet eth0: device MAC address a2:11:d7:ec:a3:11
[   17.517491] Adding 236876k swap on /dev/zram0.  Priority:5 extents:1 across:236876k SSFS
[   17.522599] zram1: detected capacity change from 0 to 242565120
[   17.534696] Adding 236876k swap on /dev/zram1.  Priority:5 extents:1 across:236876k SSFS
[   17.536027] zram2: detected capacity change from 0 to 242565120
[   17.547550] Adding 236876k swap on /dev/zram2.  Priority:5 extents:1 across:236876k SSFS
[   17.548922] zram3: detected capacity change from 0 to 242565120
[   17.549250] Meson GXL Internal PHY 0.e40908ff:08: attached PHY driver [Meson GXL Internal PHY] (mii_bus:phy_addr=0.e40908ff:08, irq=34)
[   17.561405] Adding 236876k swap on /dev/zram3.  Priority:5 extents:1 across:236876k SSFS
[   17.569919] meson8b-dwmac c9410000.ethernet eth0: PTP not supported by HW
[   17.570152] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   19.073373] meson8b-dwmac c9410000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[   19.073419] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   30.153095] overlayfs: upper fs does not support xattr.
[   31.940701] random: crng init done
[   35.283967] fuse init (API version 7.26)

 

 

Thanks again, for the quick reply.

Posted

I was going to do some more checking on this right away, but I forgot to take the highspeed out of the SD device tree and now it won't boot.  I'll be back after dinner when I swap my old device tree back in. (I have a very old potato without the 1.8volt line.  You would think after messing up so often I'd stop.  Nope.)

Posted

So, I did some more testing and crashed my board. I hooked up wire to what I'm calling pin 3. Honestly I'm completely confused how to number these pins now. I was referencing this page

http://wiki.loverpi.com/sbc-brand:libre-computer and the pinout link there: http://wiki.loverpi.com/pinouts

 

which has two pins labelled 2: the pin right next to 3v3, and also first 5v. Anyway I wired up the pin next to 3v3 to an LED, and also ground. I then ran a bash loop to use gpioset gpiochip1 like so:

 

chris@lepotato:~/Projects/libgpiod$ for i in {1..25}; do echo $i; sudo gpioset gpiochip1 $i'=1'; read; sudo gpioset gpiochip1 $i'=0'; done
1
gpioset: error setting the GPIO line values: Invalid argument
gpioset: error setting the GPIO line values: Invalid argument
2
gpioset: error setting the GPIO line values: Invalid argument
gpioset: error setting the GPIO line values: Invalid argument
3
gpioset: error setting the GPIO line values: Invalid argument
gpioset: error setting the GPIO line values: Invalid argument
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
gpioset: error setting the GPIO line values: Device or resource busy
gpioset: error setting the GPIO line values: Device or resource busy
20
21
22
23
24
25

 

And yeah, the LED never lit up. From that spreadsheet linked above, it should have been lighting up at 5, but it wasn't. When I tried doing the above loop all the way to 100, it eventually completely crashed my board and I had to hard reset it. 

 

Is libgpio just busted or something? 

 

I confirmed the LED works by connecting it to the ground pin and 5v, then 3v3, then the second 5v, and it lights up fine on those three. I hooked it to "pin 3" and while it gives a very slight dim light by default (not sure it's supposed to do that or what), and then never changes when I run the above loop to send it to 1 or 0.  

 

I must be doing something wrong here...

 

EDIT: Okay, so I can't get this to actually change any values anyway. 

 

l_chip=gpiochip1
chris@lepotato:~$ sudo gpioget $l_chip 5
1
chris@lepotato:~$ sudo gpioset $l_chip 5=0
chris@lepotato:~$ sudo gpioget $l_chip 5
1

 

I think these tools are broken.

 


EDIT2: Okay, I think I figured this out thanks to Neil's spreadsheet up there. I noticed pin 3 is GPIOAO_5 and gpiochip0 is called AOBUS in /sys/class/gpio:

chris@lepotato:~$ ls -l /sys/class/gpio/
total 0
--w------- 1 root root 4096 Jan  1  1970 export
lrwxrwxrwx 1 root root    0 Jan  1  1970 gpiochip0 -> ../../devices/platform/soc/c8100000.aobus/c8100000.aobus:pinctrl@14/gpio/gpiochip0
lrwxrwxrwx 1 root root    0 Jan  1  1970 gpiochip10 -> ../../devices/platform/soc/c8834000.periphs/c8834000.periphs:pinctrl@4b0/gpio/gpiochip10
--w------- 1 root root 4096 Jan  1  1970 unexport

 

So I tried switching my gpioset to use gpiochip0 and turning pin 5 off turned this off. I think I can work with this now. Thanks to Neil for providing that spreadsheet, that info seems good. 

 

Now trying to figure out how to control the pins on GPIOX on that spreadsheet. They don't map to the other chip from what I can tell.

 

EDIT3: Just going to keep updating this post for my notes in case it's helpful to anyone, and if anyone has any suggestions they can chime in.

 

I might have found my crash. I was doing a read loop on the pins of chip1, and apparently reading pin 53 triggers the filesystem to go read-only and everything goes bonkers with I/O errors after that, requiring pulling the power.

 

chris@lepotato:~$ for i in {30..60}; do printf "$i: "; sudo gpioget $l_chip2 $i; done
30: 0
31: 0
32: 0
33: 0
34: 0
35: gpioget: error reading GPIO values: Device or resource busy
36: 0
37: 0
38: 0
39: 0
40: 0
41: 0
42: 1
43: 1
44: 0
45: 1
46: 1
47: 1
48: gpioget: error reading GPIO values: Device or resource busy
49: 1
50: 1
51: 1
52: 1
53: sudo: unable to write to /var/lib/sudo/ts/chris: Read-only file system
1
54: sudo: unable to open /var/lib/sudo/ts/chris: Read-only file system

 

Eh, maybe not. I don't think the reads triggered it specifically, I tried reading those pins again after reboot and it was fine. This time, I triggered some kind of I/O issue up near pin 80? It finished the loop up to 80 and then wouldn't take any more input from my ssh session. Network completely shut off at that point, another hard reboot and I can't trigger the condition again manually. Weird.

 

EDIT: Merging the info from Tido and Neil, I think I have it now. I'll try to make a new spreadsheet (yeah I know, another?) mapping the pins to libgpiod commands.

 

Basically, I realized Tido's info was shifted by 10 from what was in gpioinfo. IE, 7J1 Pin8 is listed as gpio-101, but in gpioinfo it's 91. Thanks to both of y'all for this info. This is what I was looking for.

 

And sorry for the super long multi-edits. I don't know what this forum's etiquette for that kind of thing is.

Posted

So, I still need to verify some of the later pins, going to work on that tomorrow with a bash walker loop while I swap wires on the header to an LED. This is yet another table that maps the 40 pins to libgpio, for reference. Maybe someone will find it useful. GC0 is gpiochip0 and GC1 is gpiochip1 in libgpio. 

 

image.png.0663274af0b0514f7ca09a8c864dc786.png



 

Quick bash variable list for importing into scripts, so you can just think in terms of header pins rather than the mappings.

 

P01=NA
P02=NA
P03=0:5
P04=NA
P05=0:4
P06=NA
P07=1:98
P08=1:91
P09=NA
P10=1:92
P11=0:8
P12=0:6
P13=0:9
P14=NA
P15=1:100
P16=1:93
P17=NA
P18=1:94
P19=1:87
P20=NA
P21=1:88
P22=1:79
P23=1:90
P24=1:89
P25=NA
P26=1:80
P27=1:75
P28=1:76
P29=1:96
P30=NA
P31=1:97
P32=1:95
P33=1:85
P34=NA
P35=1:86
P36=1:81
P37=1:84
P38=1:82
P39=NA
P40=1:83

 

Example bash script:

 

#!/bin/bash

. pinheaders #This is the above variable list as a separate file

print() {
for i in {01..40}; do
    var=P${i} 
    printf "Pin $i: ${!var}\n";
done
}

walk() {
for i in {01..40}; do
    var=P${i}
    if [[ ! ${!var} = "NA" ]]; then 
        chip=gpiochip$(echo ${!var} | cut -f1 -d:)
        pin=$(echo ${!var} | cut -f2 -d:)
        gpioset $chip ${pin}=1
        sleep .5
        gpioset $chip ${pin}=0
    fi
done
}

 

You get the idea. If you're working with just pins 27 and 28 you can source the pinheader file, then use $P27 and $P28 to get the chip and pin from that variable.

 

Hopefully this info is useful to someone searching the forum like I was.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines