GPIO access on Custom BBB


#1

Hello -

We’re debugging a new design based on the BBB RevC where we’ve eliminated the eMMC. I assigned several GPIOs that would have been allocated to the eMMC data lines and I cannot manipulate them. On a BBB, I can disable the eMMC overlay in /boot/uEnv.txt and I get access to my gpios and they respond. On my custom board (designed with no eMMC) I am unable to do this. When I disable the eMMC overlay in /boot/uEnv.txt the board suddenly will not boot. I’ve been unsuccessful in using the pin mux to change the pin modes to GPIO and I will admit up front I’m probably not be doing the right way but the config-pin commands worked for UART1.

I am using the latest debian stretch IoT image

      debian@beaglebone:~$ uname
      Linux beaglebone 4.14.67-ti-r73 #1 SMP PREEMPT Thu Aug 30 00:08:52 UTC 2018 armv7l GNU/Linux

I need to control gpio32, gpio34, gpio35 and gpio36 (P8_25, P8_05, P8_06, P8_23 respectively.) These are all MMC1_DATx pins.

Again - if I disable the eMMC overlay in /boot/uEnv.txt on a BBB with the same kernel I can at least manipulate gpio32 (I haven’t bothered to try the others). However, if I stick that same uSD card into my custom board, suddenly it won’t boot and the only change has been to disable the eMMC overlay.

Thanks in advance for your help and suggestions

Here is my uEnv.txt file:

debian@beaglebone:~$ cat /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r=4.14.67-ti-r73
#uuid=
#dtb=

###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
uboot_overlay_addr4=/lib/firmware/BB-SPIDEV0-00A0.dtbo
uboot_overlay_addr5=/lib/firmware/BB-SPIDEV1-00A0.dtbo
#uboot_overlay_addr6=/lib/firmware/BB-UART1-00A0.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.4.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
###pru_rproc (4.14.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_uio (4.4.x-ti, 4.14.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 quiet video=HDMI-A-1:1024x768@60e

#Use an overlayfs on top of a read-only root filesystem:
#cmdline=coherent_pool=1M net.ifnames=0 quiet overlayroot=tmpfs

##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

#2

@AdamG,

Can you plug-in a usb-serial adapter and share U-Boot bootup log on your custom pcb?

Regards,


#3

Thanks for the prompt response. This appears to be one of those very fun moments in engineering when you get a little egg on your face!

Through the serial debug port I rebooted to capture the full boot log, then I modified my /boot/uEnv.txt file to uncomment the emmc overlay disable, saved it and rebooted. It boots all the way now. I’m baffled. This must be the 5th or 6th time I’ve done this simple test and I can’t explain why it works now. Regardless… Here is the resulting boot log. If you have a moment I would really appreciate it if you could review the boot log and let me know if you see anything I need to be concerned about. I have already validated gpio32 and gpio34 - they both respond to unix commands now.

THIS BOOT LOG FROM CUSTOM BOARD WITH EMMC OVERLAY ENABLED

U-Boot SPL 2018.09-rc2-dirty (Sep 07 2018 - 09:13:58 -0400)
Trying to boot from MMC1
Loading Environment from EXT4... ** File not found /boot/uboot.env **
** Unable to read &quot;/boot/uboot.env&quot; from mmc0:1 **
U-Boot 2018.09-rc2-dirty (Sep 07 2018 - 09:13:58 -0400)
CPU : AM335X-GP rev 2.1
I2C: ready
DRAM: 512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
Reset Source: Power-on reset has occurred.
RTC 32KCLK Source: External.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from EXT4... ** File not found /boot/uboot.env **
** Unable to read &quot;/boot/uboot.env&quot; from mmc0:1 **
Board: BeagleBone Black
&lt;ethaddr&gt; not set. Validating first E-fuse MAC
BeagleBone Black:
BeagleBone: cape eeprom: i2c_probe: 0x54:
BeagleBone: cape eeprom: i2c_probe: 0x55:
BeagleBone: cape eeprom: i2c_probe: 0x56:
BeagleBone: cape eeprom: i2c_probe: 0x57:
Net: eth0: MII MODE
cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds
board_name=[A335BNLT] ...
board_rev=[] ...
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
switch to partitions #0, OK
mmc0 is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt ...
Checking for: /boot.scr ...
Checking for: /boot/boot.scr ...
Checking for: /boot/uEnv.txt ...
gpio: pin 55 (gpio 55) value is 1
2117 bytes read in 26 ms (79.1 KiB/s)
Loaded environment from /boot/uEnv.txt
Checking if uname_r is set in /boot/uEnv.txt...
gpio: pin 56 (gpio 56) value is 1
Running uname_boot ...
loading /boot/vmlinuz-4.14.67-ti-r73 ...
10379776 bytes read in 674 ms (14.7 MiB/s)
debug: [enable_uboot_overlays=1] ...
debug: [enable_uboot_cape_universal=1] ...
debug: [uboot_base_dtb_univ=am335x-boneblack-uboot-univ.dtb] ...
uboot_overlays: [uboot_base_dtb=am335x-boneblack-uboot-univ.dtb] ...
uboot_overlays: Switching too: dtb=am335x-boneblack-uboot-univ.dtb ...
loading /boot/dtbs/4.14.67-ti-r73/am335x-boneblack-uboot-univ.dtb ...
161723 bytes read in 66 ms (2.3 MiB/s)
uboot_overlays: [fdt_buffer=0x60000] ...
uboot_overlays: loading /lib/firmware/BB-SPIDEV0-00A0.dtbo ...
1523 bytes read in 586 ms (2 KiB/s)
uboot_overlays: loading /lib/firmware/BB-SPIDEV1-00A0.dtbo ...
1523 bytes read in 186 ms (7.8 KiB/s)
uboot_overlays: loading /lib/firmware/BB-BONE-eMMC1-01-00A0.dtbo ...
1440 bytes read in 176 ms (7.8 KiB/s)
uboot_overlays: uboot loading of [/lib/firmware/BB-HDMI-TDA998x-00A0.dtbo] disabled by /boot/uEnv.txt [disable_uboot_overlay_video=1]...
uboot_overlays: loading /lib/firmware/BB-ADC-00A0.dtbo ...
711 bytes read in 222 ms (2.9 KiB/s)
uboot_overlays: loading /lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo ...
3513 bytes read in 698 ms (4.9 KiB/s)
loading /boot/initrd.img-4.14.67-ti-r73 ...
4791746 bytes read in 325 ms (14.1 MiB/s)
debug: [console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet] ...
debug: [bootz 0x82000000 0x88080000:491dc2 88000000] ...
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Loading Ramdisk to 8fb6e000, end 8ffffdc2 ... OK
reserving fdt memory region: addr=88000000 size=88000
Loading Device Tree to 8fae3000, end 8fb6dfff ... OK
Starting kernel ...
[ 0.002087] timer_probe: no matching timers found
[ 0.617969] dmi: Firmware registration failed.
[ 1.145529] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
[ 1.437041] dmi-sysfs: dmi entry is absent.
[ 1.470788] omap_voltage_late_init: Voltage driver support not added
[ 1.943307] musb-hdrc musb-hdrc.1: VBUS_ERROR in a_wait_vrise (80, &lt;SessEnd), retry #3, port1 0008010c
rootfs: recovering journal
rootfs: clean, 87184/217728 files, 551197/869376 blocks
Debian GNU/Linux 9 beaglebone ttyS0
BeagleBoard,org Debian Image 2018-08-30
Support/FAQ: http;//elinux,org/Beagleboard:BeagleBoneBlack_Debian
default username:password is [debian:temppwd]
beaglebone login: debian
Password:
Last login: Thu Oct 4 15:48:02 UTC 2018 from 192.168.0.129 on pts/0
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
debian@beaglebone:~$ sudo nano /boot/uEnv.txt
[sudo] password for debian:
GNU nano 2.7.4 New Buffer
debian@beaglebone:~$ cd /boot
debian@beaglebone:/boot$ sudo nano uEnv.txt
GNU nano 2.7.4 File: uEnv.txt
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/&lt;file0&gt;.dtbo
#uboot_overlay_addr1=/lib/firmware/&lt;file1&gt;.dtbo
#uboot_overlay_addr2=/lib/firmware/&lt;file2&gt;.dtbo
#uboot_overlay_addr3=/lib/firmware/&lt;file3&gt;.dtbo
###
###Additional custom capes
uboot_overlay_addr4=/lib/firmware/BB-SPIDEV0-00A0.dtbo
uboot_overlay_addr5=/lib/firmware/BB-SPIDEV1-00A0.dtbo
#uboot_overlay_addr6=/lib/firmware/BB-UART1-00A0.dtbo
#uboot_overlay_addr7=/lib/firmware/&lt;file7&gt;.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/&lt;file8&gt;.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
**debian@beaglebone:/boot$ sudo reboot**
[ 117.526584] watchdog: watchdog0: watchdog did not stop!
[ 117.782262] reboot: Restarting system

THIS BOOT LOG FROM CUSTOM BOARD WITH EMMC OVERLAY DISABLED

U-Boot SPL 2018.09-rc2-dirty (Sep 07 2018 - 09:13:58 -0400)
Trying to boot from MMC1
Loading Environment from EXT4... ** File not found /boot/uboot.env **
** Unable to read &quot;/boot/uboot.env&quot; from mmc0:1 **
U-Boot 2018.09-rc2-dirty (Sep 07 2018 - 09:13:58 -0400)
CPU : AM335X-GP rev 2.1
I2C: ready
DRAM: 512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
Reset Source: Global warm SW reset has occurred.
Reset Source: Power-on reset has occurred.
RTC 32KCLK Source: External.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from EXT4... ** File not found /boot/uboot.env **
** Unable to read &quot;/boot/uboot.env&quot; from mmc0:1 **
Board: BeagleBone Black
&lt;ethaddr&gt; not set. Validating first E-fuse MAC
BeagleBone Black:
BeagleBone: cape eeprom: i2c_probe: 0x54:
BeagleBone: cape eeprom: i2c_probe: 0x55:
BeagleBone: cape eeprom: i2c_probe: 0x56:
BeagleBone: cape eeprom: i2c_probe: 0x57:
Net: eth0: MII MODE
cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds
board_name=[A335BNLT] ...
board_rev=[] ...
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
switch to partitions #0, OK
mmc0 is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt ...
Checking for: /boot.scr ...
Checking for: /boot/boot.scr ...
Checking for: /boot/uEnv.txt ...
gpio: pin 55 (gpio 55) value is 1
2116 bytes read in 24 ms (85.9 KiB/s)
Loaded environment from /boot/uEnv.txt
Checking if uname_r is set in /boot/uEnv.txt...
gpio: pin 56 (gpio 56) value is 1
Running uname_boot ...
loading /boot/vmlinuz-4.14.67-ti-r73 ...
10379776 bytes read in 674 ms (14.7 MiB/s)
debug: [enable_uboot_overlays=1] ...
debug: [enable_uboot_cape_universal=1] ...
debug: [uboot_base_dtb_univ=am335x-boneblack-uboot-univ.dtb] ...
uboot_overlays: [uboot_base_dtb=am335x-boneblack-uboot-univ.dtb] ...
uboot_overlays: Switching too: dtb=am335x-boneblack-uboot-univ.dtb ...
loading /boot/dtbs/4.14.67-ti-r73/am335x-boneblack-uboot-univ.dtb ...
161723 bytes read in 69 ms (2.2 MiB/s)
uboot_overlays: [fdt_buffer=0x60000] ...
uboot_overlays: loading /lib/firmware/BB-SPIDEV0-00A0.dtbo ...
1523 bytes read in 584 ms (2 KiB/s)
uboot_overlays: loading /lib/firmware/BB-SPIDEV1-00A0.dtbo ...
1523 bytes read in 186 ms (7.8 KiB/s)
uboot_overlays: uboot loading of [/lib/firmware/BB-BONE-eMMC1-01-00A0.dtbo] disabled by /boot/uEnv.txt [disable_uboot_overlay_emmc=1]...
uboot_overlays: uboot loading of [/lib/firmware/BB-HDMI-TDA998x-00A0.dtbo] disabled by /boot/uEnv.txt [disable_uboot_overlay_video=1]...
uboot_overlays: loading /lib/firmware/BB-ADC-00A0.dtbo ...
711 bytes read in 222 ms (2.9 KiB/s)
uboot_overlays: loading /lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo ...
3513 bytes read in 700 ms (4.9 KiB/s)
loading /boot/initrd.img-4.14.67-ti-r73 ...
4791746 bytes read in 325 ms (14.1 MiB/s)
debug: [console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet] ...
debug: [bootz 0x82000000 0x88080000:491dc2 88000000] ...
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Loading Ramdisk to 8fb6e000, end 8ffffdc2 ... OK
reserving fdt memory region: addr=88000000 size=88000
Loading Device Tree to 8fae3000, end 8fb6dfff ... OK
Starting kernel ...
[ 0.002079] timer_probe: no matching timers found
[ 0.618063] dmi: Firmware registration failed.
[ 1.147334] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
[ 1.416987] dmi-sysfs: dmi entry is absent.
[ 1.449272] omap_voltage_late_init: Voltage driver support not added
[ 1.956094] musb-hdrc musb-hdrc.1: VBUS_ERROR in a_wait_vrise (80, &lt;SessEnd), retry #3, port1 0008010c
rootfs: clean, 87182/217728 files, 551235/869376 blocks
Debian GNU/Linux 9 beaglebone ttyS0
BeagleBoard,org Debian Image 2018-08-30
Support/FAQ: http;//elinux,org/Beagleboard:BeagleBoneBlack_Debian
default username:password is [debian:temppwd]
beaglebone login: debian
Password:
Last login: Fri Oct 5 18:32:48 UTC 2018 on ttyS0
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
debian@beaglebone:~$ cd /sys/class/gpio
debian@beaglebone:/sys/class/gpio$ ls
export gpio117 gpio27 gpio38 gpio50 gpio69 gpio78 gpiochip0
gpio10 gpio12 gpio3 gpio39 gpio51 gpio7 gpio79 gpiochip32
gpio11 gpio13 gpio30 gpio4 gpio60 gpio70 gpio8 gpiochip64
gpio110 gpio14 gpio31 gpio44 gpio61 gpio71 gpio80 gpiochip96
gpio111 gpio15 gpio32 gpio45 gpio62 gpio72 gpio81 unexport
gpio112 gpio2 gpio33 gpio46 gpio63 gpio73 gpio86
gpio113 gpio20 gpio34 gpio47 gpio65 gpio74 gpio87
gpio114 gpio22 gpio35 gpio48 gpio66 gpio75 gpio88
gpio115 gpio23 gpio36 gpio49 gpio67 gpio76 gpio89
gpio116 gpio26 gpio37 gpio5 gpio68 gpio77 gpio9
debian@beaglebone:/sys/class/gpio$ cd gpio34
debian@beaglebone:/sys/class/gpio/gpio34$ cat direction
in
debian@beaglebone:/sys/class/gpio/gpio34$ echo out &gt; direction
debian@beaglebone:/sys/class/gpio/gpio34$ cat direction
out
debian@beaglebone:/sys/class/gpio/gpio34$ cat value
0
debian@beaglebone:/sys/class/gpio/gpio34$ echo 1 &gt; value
debian@beaglebone:/sys/class/gpio/gpio34$ echo 0 &gt; value
debian@beaglebone:/sys/class/gpio/gpio34$ echo 1 &gt; value
debian@beaglebone:/sys/class/gpio/gpio34$
**gpio32 and gpio34 both working now and the OS boots with emmc overlay disabled.**

#4

I see you have correctly set the eeprom…

board_name=[A335BNLT] ...
board_rev=[] ...

Which was my initial theory of why it “wasn’t” working… But it’s set correctly. Normally that’s the cause of boot issues.

If it does fail again, let’s grab the serial boot log, that’s the best indicator of what went wrong…

Regards,