[how to] beaglebone works like debian image (gpio, cap, ...)

This forum is for supported devices using an ARMv7 Texas Instruments (TI) SoC.

[how to] beaglebone works like debian image (gpio, cap, ...)

Postby coOlibry » Sat May 02, 2020 4:46 pm

Hello,
i play with beaglebone black and would like the same use of gpio as debian image,

the first step is in /boot/boot.txt
original file is here :
inside this, after :
$this->bbcode_second_pass_code('', 'gpio set 55')
you need to add :
$this->bbcode_second_pass_code('', ' fdt addr ${fdtaddr} # without this line nothing are loaded
fdt resize 0x60000 # need space for loading dtbo file
# disable HDMI
load ${devtype} ${devnum}:${bootpart} ${rdaddr} /lib/firmware/BB-NHDMI-TDA998x-00A0.dtbo
fdt apply ${rdaddr} # need after every dtbo to apply
# example load ADC cap
# load ${devtype} ${devnum}:${bootpart} ${rdaddr} /lib/firmware/BB-ADC-00A0.dtbo
# fdt apply ${rdaddr}
# example load driver for BME280 sensors connected on i2c2
# load ${devtype} ${devnum}:${bootpart} ${rdaddr} /lib/firmware/BB-I2C2-BME280.dtbo
# fdt apply ${rdaddr}
# load universal cap
load ${devtype} ${devnum}:${bootpart} ${rdaddr} /lib/firmware/univ-bbb-Exx-00A0.dtbo
fdt apply ${rdaddr}
')
with this hdmi is disabled and universal cap is loaded,
you can adapt this example to your need :
verify what available in /lib/firmware
explanation about the univ dtbo :
bbb=Classic Black, E = eMMC enabled, x = video disable, x = audio disabled

an utility called config-pin is very usefull, link,
to use it, in /boot/boot.txt, on line "setenv bootargs", at the end you need to add this :
$this->bbcode_second_pass_code('', 'bone_capemgr.uboot_capemgr_enabled=1')
another usefull utilty is show-pins, link,

after this run mkscr and reboot,
at this point config-pin and show-pins works and you can play with gpio,
but with kernel newer than 4.20, eqep don't works, and i think some other,
Last edited by coOlibry on Sat May 02, 2020 8:12 pm, edited 2 times in total.
coOlibry
 
Posts: 4
Joined: Wed Apr 15, 2020 6:05 am

Re: [how to] beaglebone works like debian image (gpio, cap,

Postby coOlibry » Sat May 02, 2020 7:58 pm

now you may want to use python library :
install from aur python-adafruit_bbio-git
but you need to add this line : $this->bbcode_second_pass_code('', 'sed -e "s/ '-Werror',//g" -i "setup.py"')before line $this->bbcode_second_pass_code('', 'python setup.py install --root="$pkgdir/" --optimize=1')
after installed, access gpio with python is very easy, documentation here
but as i said before eqep is not available,
to get easy access to all gpio, kernel need to be less than 4.20,
the easiest solution is to download archive of older kernel here
and install it manually,

to get access gpio from user:
1) grab rules from this page
past it on /etc/udev/rules.d/
2) add group as you need :$this->bbcode_second_pass_code('', 'groupadd gpio --system
groupadd pwm --system
groupadd i2c --system
groupadd eqep --system
groupadd remoteproc --system
groupadd rpmsg_pru --system

usermod -a -G gpio, pwm, i2c, eqep your_user
')
3) add this line in /etc/fstab :
$this->bbcode_second_pass_code('', 'debugfs /sys/kernel/debug debugfs mode=755,uid=root,gid=gpio,defaults 0 0')

after reboot gpio access are the same as debian,

for best use cross-compile kernel 4.14 or 4.19 with latest patch,
actually i'm on 4.14 kernel and use gpio( button, relay and led), eqep for rotary encoder,

for rotary encoder, use H/W debouncing, like this link.

i think some of this can be integrated in the wiki or / and image need update,
a package linux-am33x-4.14 with latest patch might be usefull (or 4.19).
coOlibry
 
Posts: 4
Joined: Wed Apr 15, 2020 6:05 am

Re: [how to] beaglebone works like debian image (gpio, cap,

Postby summers » Sun May 03, 2020 10:48 am

This is the thread where we looked at how to do overlays before: https://archlinuxarm.org/forum/viewtopic.php?f=23&t=12635

Main difference is we took out the hdmi by hand, and the load command has the size of the load in the env variable filesize. This means you can use that for the fdt resize, which in turn means you only make the device tree as large as it needs to be.

Why doesn't it work with a modern kernel?
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: [how to] beaglebone works like debian image (gpio, cap,

Postby coOlibry » Fri May 08, 2020 7:26 am

thanks for your message,
for eqep new drivers as been made link,
i tested this and it's works with kernel 5.4 and 5.6.11
very easy to use and integrate in my python script,
with default kernel (5.6.11),
i noticed some glitch when play music with my usb sound card (even more on load),
the other default is linux-firmware dependency (500MO for 4Go Emmc is not a good idea),
also this is not used in my environnement,

i make my own 5.4.34 kernel with config from https://rcn-ee.com/deb/sid-armhf/v5.4.34-bone24/
i made little adaptation :
$this->bbcode_second_pass_code('', '--- /home/user/beaglebone/linux-am33x-5.4/defconfig
+++ /home/user/beaglebone/linux-am33x-5.4/config
@@ -22,7 +22,7 @@
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
# CONFIG_COMPILE_TEST is not set
-CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION="-ARCH"
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_BUILD_SALT=""
CONFIG_HAVE_KERNEL_GZIP=y
@@ -32,8 +32,8 @@
CONFIG_HAVE_KERNEL_LZ4=y
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_LZMA is not set
-# CONFIG_KERNEL_XZ is not set
-CONFIG_KERNEL_LZO=y
+CONFIG_KERNEL_XZ=y
+# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SWAP=y
@@ -482,9 +482,9 @@
CONFIG_ATAGS_PROC=y
CONFIG_CRASH_DUMP=y
CONFIG_AUTO_ZRELADDR=y
-CONFIG_EFI_STUB=y
-CONFIG_EFI=y
-CONFIG_DMI=y
+# CONFIG_EFI_STUB is not set
+# CONFIG_EFI is not set
+# CONFIG_DMI is not set
# end of Boot options

#
@@ -597,14 +597,14 @@
#
# EFI (Extensible Firmware Interface) Support
#
-CONFIG_EFI_VARS=m
-CONFIG_EFI_ESRT=y
-CONFIG_EFI_PARAMS_FROM_FDT=y
-CONFIG_EFI_RUNTIME_WRAPPERS=y
-CONFIG_EFI_ARMSTUB=y
+# CONFIG_EFI_VARS=m
+# CONFIG_EFI_ESRT=y
+# CONFIG_EFI_PARAMS_FROM_FDT=y
+# CONFIG_EFI_RUNTIME_WRAPPERS=y
+# CONFIG_EFI_ARMSTUB=y
# CONFIG_EFI_ARMSTUB_DTB_LOADER is not set
-CONFIG_EFI_BOOTLOADER_CONTROL=m
-CONFIG_EFI_CAPSULE_LOADER=m
+# CONFIG_EFI_BOOTLOADER_CONTROL=m
+# CONFIG_EFI_CAPSULE_LOADER=m
# CONFIG_EFI_TEST is not set
# CONFIG_RESET_ATTACK_MITIGATION is not set
# end of EFI (Extensible Firmware Interface) Support
@@ -723,8 +723,8 @@
# CONFIG_MODULE_SRCVERSION_ALL is not set
# CONFIG_MODULE_SIG is not set
CONFIG_MODULE_COMPRESS=y
-# CONFIG_MODULE_COMPRESS_GZIP is not set
-CONFIG_MODULE_COMPRESS_XZ=y
+CONFIG_MODULE_COMPRESS_GZIP=y
+# CONFIG_MODULE_COMPRESS_XZ is not set
# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set
# CONFIG_UNUSED_SYMBOLS is not set
# CONFIG_TRIM_UNUSED_KSYMS is not set
@@ -6448,7 +6448,7 @@
# CONFIG_SLIMBUS is not set
# CONFIG_INTERCONNECT is not set
CONFIG_COUNTER=m
-# CONFIG_TI_EQEP is not set
+CONFIG_TI_EQEP=m
# CONFIG_FTM_QUADDEC is not set
# end of Device Drivers
')

i move linux-firmware to optional

with this config glitch while playing is very very low, even on load.
gpio (input, output and qep) works normally
from now i stay on 5.4 kernel,
information i write before need update.
coOlibry
 
Posts: 4
Joined: Wed Apr 15, 2020 6:05 am

Re: [how to] beaglebone works like debian image (gpio, cap,

Postby summers » Fri May 08, 2020 11:40 am

I've only ever done usb sound card on my desktop (AMD E350 - so ancient processor). Anyway can capture there at high rate (192kHz @ 24 bits) with almost no load on the AMD350; I suspect the focusrite sound card just has very good buffering. So I'd expect it to work on the beagle board.

This though is a separate issue from overlays, and GPIO though isn't it. Mainly because it comes up via usb, and that doesn't need overlays.

I not tried playing sound on the usb sound card (there isn't yet a linux driver for 3rd gen focusrite - so you can't control the various bits needed, at least didn't seem possible to me). But aside from latency issues, would expect it to work fine.

Looks like the mainline kernel has a driver for the counter in eQEP: https://github.com/torvalds/linux/blob/master/drivers/counter/ti-eqep.c, does it need more than that?
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: [how to] beaglebone works like debian image (gpio, cap,

Postby coOlibry » Fri May 08, 2020 12:09 pm

as i said in my previous post i use eQEP driver from kernel,
i use it to adjust volume and it's works perfect.
for usb soundcard i use :
$this->bbcode_second_pass_code('', '1235:801c Focusrite-Novation Scarlett Solo USB (gen 1)')
coOlibry
 
Posts: 4
Joined: Wed Apr 15, 2020 6:05 am


Return to Texas Instruments (TI)

Who is online

Users browsing this forum: No registered users and 3 guests