Pins and Port configuration in the Beagleboard xM

Hi everyone,

I´m just starting a project where I´m going to do some tests with a Beagleboard xM that needs to control an external board through a UART channel, some PWM pins, and some GPIOs.

I´ve just prepare my SD Card with the last Debian Image from this link:

https://debian.beagleboard.org/images/bbxm-debian-9.5-lxqt-xm-armhf-2018-10-07-4gb.img.xz

Boot the system and seems everything looks good:

U-Boot SPL 2018.09-00001-ge10814359b (Sep 10 2018 - 19:52:59 -0500)
Trying to boot from MMC1
spl_load_image_fat_os: error reading image args, err - -2

U-Boot 2018.09-00001-ge10814359b (Sep 10 2018 - 19:52:59 -0500), Build: jenkins-github_Bootloader-Builder-65

OMAP3630/3730-GP ES1.2, CPU-OPP2, L3-200MHz, Max CPU Clock 1 GHz
Model: TI OMAP3 BeagleBoard
OMAP3 Beagle board + LPDDR/NAND
I2C: ready
DRAM: 256 MiB
NAND: 0 MiB
MMC: OMAP SD/MMC: 0
Loading Environment from NAND… *** Warning - readenv() failed, using default environment

Beagle xM Rev C
No EEPROM on expansion board
No EEPROM on expansion board
OMAP die ID: 6c0a00029ff8000001578ca01101202e
Net: usb_ether
starting USB…
USB0: USB EHCI 1.00
scanning bus 0 for devices… 3 USB Device(s) found
scanning usb for storage devices… 0 Storage Device(s) found
scanning usb for ethernet devices… 1 Ethernet Device(s) found
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1…
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
Checking for: /uEnv.txt …
Checking for: /boot/uEnv.txt …
432 bytes read in 27 ms (15.6 KiB/s)
Loaded environment from /boot/uEnv.txt
Checking if uname_r is set in /boot/uEnv.txt…
Running uname_boot …
loading /boot/vmlinuz-4.18.11-armv7-x11 …
6550016 bytes read in 520 ms (12 MiB/s)
loading /boot/dtbs/4.18.11-armv7-x11/omap3-beagle-xm.dtb …
94492 bytes read in 786 ms (117.2 KiB/s)
loading /boot/initrd.img-4.18.11-armv7-x11 …
4745973 bytes read in 390 ms (11.6 MiB/s)
debug: [console=ttyO2,115200n8 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet] …
debug: [bootz 0x82000000 0x88080000:486af5 0x88000000] …

Flattened Device Tree blob at 88000000

Booting using the fdt blob at 0x88000000
Loading Ramdisk to 89b79000, end 89fffaf5 … OK
Loading Device Tree to 89b5e000, end 89b7811b … OK

Starting kernel …

[ 4.520965] Error: Driver ‘tfp410’ is already registered, aborting…
[ 5.108215] omap2_set_init_voltage: unable to find boot up OPP for vdd_core
[ 5.115936] omap2_set_init_voltage: unable to set vdd_core
[FAILED] Failed to start Load Kernel Modules.
See ‘systemctl status systemd-modules-load.service’ for details.
[DEPEND] Dependency failed for robotcontrol.
[ OK ] Started Create list of required sta…vice nodes for the current kernel.
[ OK ] Started File System Check Daemon to report status.
Starting Create Static Device Nodes in /dev…
Mounting Configuration File System…
Mounting FUSE Control File System…
Starting Apply Kernel Variables…
[ OK ] Mounted Configuration File System.
[ OK ] Mounted FUSE Control File System.
[ OK ] Started File System Check on Root Device.
[ OK ] Started Create Static Device Nodes in /dev.
[ OK ] Started Apply Kernel Variables.
[ OK ] Started Journal Service.
Starting udev Kernel Device Manager…
Starting Remount Root and Kernel File Systems…
[ OK ] Started Remount Root and Kernel File Systems.
Starting Load/Save Random Seed…
Starting Flush Journal to Persistent Storage…
Starting udev Coldplug all Devices…
[ OK ] Started Load/Save Random Seed.
[ OK ] Started udev Kernel Device Manager.
[ OK ] Started Flush Journal to Persistent Storage.
[ OK ] Started Set the console keyboard layout.
[ OK ] Reached target Local File Systems (Pre).
[ OK ] Reached target Local File Systems.
Starting Create Volatile Files and Directories…
Starting Set console font and keymap…
Starting Raise network interfaces…
[ OK ] Started Set console font and keymap.
[ OK ] Started Create Volatile Files and Directories.
Starting Network Time Synchronization…
[ OK ] Started Entropy daemon using the HAVEGE algorithm.
Starting Update UTMP about System Boot/Shutdown…
[ OK ] Started Update UTMP about System Boot/Shutdown.
[ OK ] Started Network Time Synchronization.
[ OK ] Reached target System Time Synchronized.
[ OK ] Started Raise network interfaces.
[ OK ] Started udev Coldplug all Devices.
[ OK ] Reached target System Initialization.
[ OK ] Listening on bonescript.socket.
[ OK ] Listening on cloud9.socket.
[ OK ] Started Daily apt download activities.
[ OK ] Started Daily apt upgrade and clean activities.
[ OK ] Started Daily Cleanup of Temporary Directories.
[ OK ] Reached target Timers.
[ OK ] Listening on node-red.socket.
[ OK ] Listening on Avahi mDNS/DNS-SD Stack Activation Socket.
[ OK ] Listening on D-Bus System Message Bus Socket.
[ OK ] Reached target Sockets.
[ OK ] Reached target Basic System.
Starting LSB: Load kernel modules needed to enable cpufreq scaling…
[ OK ] Started Deferred execution scheduler.
Starting LSB: Start busybox udhcpd at boot time…
Starting Restore /etc/resolv.conf i…fore the ppp link was shut down…
Starting Login Service…
Starting Avahi mDNS/DNS-SD Stack…
[ OK ] Started Bonescript autorun.
[ OK ] Started Regular background program processing daemon.
Starting rc_battery_monitor…
Starting BB WL18xx wlan0 Service…
Starting Generic Board Startup…
Starting System Logging Service…
[ OK ] Started D-Bus System Message Bus.
[ OK ] Started Avahi mDNS/DNS-SD Stack.
Starting Connection service…
[ OK ] Started System Logging Service.
[ OK ] Started Restore /etc/resolv.conf if…before the ppp link was shut down.
[ OK ] Started rc_battery_monitor.
[ OK ] Started BB WL18xx wlan0 Service.
[ OK ] Started Connection service.
[ OK ] Started LSB: Start busybox udhcpd at boot time.
[ OK ] Started Login Service.
[ OK ] Reached target Network.
Starting OpenBSD Secure Shell server…
Starting Permit User Sessions…
Starting The Apache HTTP Server…
[ OK ] Reached target Network is Online.
Starting LSB: Advanced IEEE 802.11 management daemon…
[ OK ] Started Permit User Sessions.
[ OK ] Started LSB: Advanced IEEE 802.11 management daemon.
Starting Light Display Manager…
[ OK ] Started Getty on tty1.
[ OK ] Started LSB: Load kernel modules needed to enable cpufreq scaling.
Starting Hostname Service…
Starting LSB: set CPUFreq kernel parameters…
Starting WPA supplicant…
[ OK ] Started OpenBSD Secure Shell server.
[ OK ] Started Hostname Service.
[ OK ] Started LSB: set CPUFreq kernel parameters.
[ OK ] Started WPA supplicant.
[ OK ] Started The Apache HTTP Server.
[ OK ] Started Light Display Manager.
[ 51.872741] OF: graph: no port node found in /ocp@68000000/isp@480bc000/ports

Debian GNU/Linux 9 beagleboard ttyS2

BeagleBoard.org Debian Image 2018-10-07

Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian

default username:password is [debian:temppwd]

beagleboard login: debian
Password:

My question is, as I´ll try to control the PinMux to use the P9 expansion header (to be able to use the UART2), I was curious to see the functions that this image has. I found that I can execute the config-pin -i command to see that:

debian@beagleboard:~$ config-pin -i P9_24
Pin name: P9_24
Function if no cape loaded: gpio
Function if cape loaded: default gpio gpio_pu gpio_pd gpio_input uart can i2c pru_uart pruin
Function information: gpio0_15 default gpio0_15 gpio0_15 gpio0_15 gpio0_15 uart1_txd dcan1_rx i2c1_scl pru_uart pru0_in16
Kernel GPIO id: 15
PRU GPIO id: 47
debian@beagleboard:~$ config-pin -i P9_1
Pin is not modifyable: P9_01 GND

I can see that the P9_1 says it´s GND when it´s actully 1V8 in the schematic of my Rev C2 version

Additionally I can see that the functions match the beagle board (non xM), so it seems the system has boot as a BBB.
So, I´m not sure if I have a wrong image or if the config-pin -i command is not actually reflecting the xM reality, or I have to so an additional configuration when booting to correclty match the xM

Thanks for the support.
Regards.

Patches welcome, config-pin currently doesn't support the original
Beagle OR Beagle-xM..

Regards,

You could try my config-pin replacement written in C: http://git.munts.com/muntsos/bootkernel/initramfs/config-pin.c

Unlike the original config-pin script, my replacement derives all pin configuration information by reading files in /sys, and doesn't have any platform dependencies. I haven't used an xM in years but it seems like it ought to work.

Phil

Hi Robert, Phil

Thanks for the fast response. So some conclusions that I´m reaching are

. Waht I need for my pogram is to code some .c files to start a communication through a UART.
. I’ll need to change a pin function to use the UART2_RX (P9_8), that according the reference manual it´s not by default the UART2_RX.
. I believe that my options are:

. (a) I need to edit the DTB?. Compile a DTS file where this pin is configured as I want
. (b) Recompile the kernel with the Phil option (config-pin.c) , and I can just edit a file (in /sys)
. © Is there an API function, like open(), that can let me change the pin function directly in the .c source of my program?

Thanks a lot for the support, sorry to ask so many things.

Regards.

Nice, I like it! Do you mind if I fork it, and add it to the bb-cape package?

On the xM, there’s no p*pinmux ocp directory, as someone, needs to generate that list.

Regards,

Looking more at it, i still like it a lot, the only issue i see so
far, it's missing the "-f" option that MachineKit guys use:

config-pin -f <file>

For example:

https://github.com/machinekit/machinekit/blob/master/configs/ARM/BeagleBone/Xylotex/Xylotex.bbio

the "overlay xyz" is currently ignored in those *.bbio files, but they
like to batch the gpio setting on bootup by a file..

Otherwise, i'd like to swap out our shell script and replace it with
your implementation.

Regards,

For the xM "today" you need to rebuild the *.dtb, which kernel are you
currently using? (uname -r) I have a helper repo to make just
re-building the *.dtb easier so you don't need to rebuild the whole
kernel every time..

Regards,

config-pin.c isn't part of the kernel; it is just a C reimplementation of the userland config-pin script. It isn't a perfect replacement. It eliminates the platform configuration tables in the script, but it has some limitations. One that comes to mind is that config-pin -q will display "default" for a pin that has the default configuration, but doesn't tell you *what* the default configuration is...

Phil

Sure, go ahead and use it.

Phil

Robert, Phil,

Thanks for the support. I´ll do my best to try the option for the DTB and the option of config-pin.c from Phil. Then I´ll see what´s the way to move.
The version of my kernel is: Linux beagleboard 4.18.11-armv7-x11, if the helper repo to compile the DTB is accessible, would be great!

Thanks again
Regards.