2
votes

I am running ubuntu 18.04, kernel 4.19.94-ti-r36, on a a beaglebone black. I am connected to ssh, and am trying to adjust the boot configuration of the GPIO pins. After boot, I am able to change and query individual GPIO configurations with the "config-pin" command, which is useful for experimentation. But I would like to change all the default GPIO configuration on boot, which this tool does not appear to do.

I found this tutorial on using a device overlay to achieve this here: http://derekmolloy.ie/gpios-on-the-beaglebone-black-using-device-tree-overlays/ but I am missing the "bone_capemgr.8" directory. I googled this issue and was directed to this page, which says that device tree overlays are now deprecated, and to use u-boot overlays instead: https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays.2C_which_got_loaded I read through the article, and googled around, but I haven't found anything on how to actually use a u-boot overlay to change the configuration of the GPIO pins on boot.

Does anyone know how to do this, or know where I might find a good resource to this effect?

Thanks!

Edit: here are the steps I think I need to take, based on De Funct's answer:

  1. install bb.org-overlays found here, https://github.com/beagleboard/bb.org-overlays, with:

    sudo apt install bb-cape-overlays

  2. create a .dts file with the correct configuration

  3. compile .dts-->.dtbo file:

    dtc -O dtb -o out_file.dtbo -b 0 -@ in_file.dts (or something similar?)

  4. adjust this line in /boot/uEnv.txt file to reference compiled dts

    ###Overide capes with eeprom

    #uboot_overlay_addr0=/lib/firmware/.dtbo

  5. something to do with boot images (?)

Questions:

  1. what does searching "in the kernel" mean? how would I do this?
  2. for the actual .dts file, I looked around and found this as a starting point: https://github.com/derekmolloy/boneDeviceTree/blob/master/overlay/DM-GPIO-Test.dts My plan is to modify/extend lines 29-33 to change the boot configuration of all relevant pins. The second hex number is the pin mode I'm trying to change; that makes sense. The first hex number looks like it somehow corresponds to pin number, but I'm not sure how? for example, 0x078-->P9.12,0x184-->P9.24, etc.
  3. when/where does making an image come into play? what about making two different partitions? I didn't follow that part
1

1 Answers

0
votes

to use the uboot-overlays, which is a given for most concepts with GPIO pins on the BBB, one would have to install bb.org-overlays which are found here, https://github.com/beagleboard/bb.org-overlays, and to understand Device-Tree Specifications.

https://github.com/beagleboard/BeagleBoard-DeviceTrees will help you, too.

The Device Tree specification can be found here: https://www.devicetree.org/

In the kernel, you can search the docs. and kernel for specific, already-made device tree ideas and files.

Also, it is as simple as creating your dts file, compiling it, and putting it in the correct space on the BeagleBone Black in /boot/uEnv.txt.

For instance, if I had a specific .dtbo that I compiled from my .dts file(s), I would simply put it in the /boot/uEnv.txt file under this heading...

###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo

http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays should explain the ideas I am listing.

Oh! Also, when creating your image, one would have to create the two partitions, one for booting and the other for the actual OS/filesystem.

Once this is completed, one would have to install the file uEnv.txt in the /boot dir. by simply making the file in a text editor, saving it, and placing it in the system before compilation via make menuconfig or whatever you are using to install the boot partition and OS partition.

If you need exact placements of the files in the kernel to search under for the .dts, .dtb, and .dtbo files, ask away. I have had complications with this before and lacking understanding, I have been a drift. Luckily, there is a long list of ideas but one needs to make them accessible in the correct order.

Also: https://www.digikey.com/eewiki/display/linuxonarm/BeagleBone+Black are some ideas on how to start the image factory of making things available for the BeagleBone Black.

Edit: here are the steps I think I need to take, based on De Funct's answer:

install bb.org-overlays found here, https://github.com/beagleboard/bb.org-overlays, with:

git clone https://github.com/beagleboard/bb.org-overlays

create a .dts file with the correct configuration

Your configuration of the .dts file works too...(supposedly as I have not seen it).

compile .dts-->.dtbo file:

dtc -O dtb -o out_file.dtbo -b 0 -@ in_file.dts (or something similar?)

Not this idea. Although, compiling using the device-tree-compiler is an option, I say use their build script w/ their Makefile.

So, try ./install.sh

adjust this line in /boot/uEnv.txt file to reference compiled dts

###Overide capes with eeprom

uboot_overlay_addr0=/lib/firmware/your_newly_added_file.dtbo

...

Also and excuse me if this does not work, you can try with the BeagleBoard-DeviceTrees link I provided.

In that one, you would simply place the correct file, your .dts file, in the /src/arm/ directory, and go back to the BeagleBoard-DeviceTrees/ dir. to perform the make command.

It will perform all the necessary .dts to .dtb to .dtbo file operations.

This is the /boot/uEnv.txt file I have currently...

#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r=4.19.94-ti-r59
#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/BB-UART2-00A0.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/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.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.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###

See where the file states #dtb=? That is section where the .dtb needs to be located and uncommented by removing the hash symbol.

Also, under that particular section of the file, there are u_boot-overlay sections. You can now add your .dtbo files in those particular slots.