EBC Exercise 41 Pin Muxing for the AI

From eLinux.org
Revision as of 06:17, 17 July 2019 by Yoder (talk | contribs)
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder

The am5729 in the BeagleBone AI handles pin muxing differently than the am335x in the Black. The pin muxes are set at boot up time and shouldn't be changed.

Here's how I set the pin muxes to get access to the GPIO and a few PRU pins.

Find which device tree is being loaded

If you look in /boot/ you'll see many device trees.

bone$ cd /boot/dtbs/4.19.50-ti-r23
bone$ ls am57*
am5729-beagleboneai.dtb       am574x-idk.dtb               am57xx-beagle-x15-revc.dtb
am5729-beagleboneai.dtb.orig  am57xx-beagle-x15.dtb        am57xx-cl-som-am57x.dtb
am572x-idk.dtb                am57xx-beagle-x15-revb1.dtb  am57xx-sbc-am57x.dtb

How can you tell which one is in use? EBC_Exercise_21a_Boot_Sequence shows how to attach a serial cable which allows you to watch the boot sequence which will tell you which device tree is used. You can store output in a log file and view it.

host$ less screenlog.0
U-Boot 2019.07-rc4-00001-g607b5b738b (Jul 06 2019 - 21:01:15 -0500), Build: jenkins-github_Bootloader-Builder-127

CPU  : DRA752-GP ES2.0
Model: BeagleBoard.org BeagleBone AI
Board: BeagleBone AI REV A
DRAM:  1 GiB

Later in the file you see:

Checking for: /boot/uEnv.txt ...
loading /boot/vmlinuz-4.19.50-ti-r23 ...
10293760 bytes read in 882 ms (11.1 MiB/s)
loading /boot/dtbs/4.19.50-ti-r23/am5729-beagleboneai.dtb ...
135653 bytes read in 13 ms (10 MiB/s)

So am5729-beagleboneai.dtb is the file being used.

Get the source from the repo

You can download the source with:

bone$ git clone https://github.com/beagleboard/BeagleBoard-DeviceTrees.git
bone$ cd BeagleBoard-DeviceTrees/src/arm
bone$ ls am57*
am5729-beagleboneai.dtb        am57xx-beagle-x15.dts        am57xx-beagle-x15-revc.dts
am5729-beagleboneai.dts        am57xx-beagle-x15-revb1.dtb  am57xx-commercial-grade.dtsi
am57xx-beagle-x15-common.dtsi  am57xx-beagle-x15-revb1.dts
am57xx-beagle-x15.dtb          am57xx-beagle-x15-revc.dtb
The files ending in *.dts are the source files.  Around line 461 you'll see:
	cape_pins_default: cape_pins_default {
		pinctrl-single,pins = <
			DRA7XX_CORE_IOPAD(0x379C, MUX_MODE14) /* AB8: P8.3: mmc3_dat6.off */
			DRA7XX_CORE_IOPAD(0x37A0, MUX_MODE14) /* AB5: P8.4: mmc3_dat7.off */
			DRA7XX_CORE_IOPAD(0x378C, MUX_MODE14) /* AC9: P8.5: mmc3_dat2.off */
			DRA7XX_CORE_IOPAD(0x3790, MUX_MODE14) /* AC3: P8.6: mmc3_dat3.off */
			DRA7XX_CORE_IOPAD(0x35B4, MUX_MODE13) /* A3: P8.15b: vin2a_d19.off */
			DRA7XX_CORE_IOPAD(0x35BC, MUX_MODE13) /* B4: P8.16: vin2a_d21.off */
			DRA7XX_CORE_IOPAD(0x3624, MUX_MODE14) /* A7: P8.17: vout1_d18.off */
			DRA7XX_CORE_IOPAD(0x3588, MUX_MODE12) /* F5: P8.18: vin2a_d8.off */
			DRA7XX_CORE_IOPAD(0x358C, MUX_MODE12) /* E6: P8.19: vin2a_d9.off */

MUX_MODE14 is the setting for GPIO. MODE13 is for PRU out and MODE12 is PRU in.

thumb‎ Embedded Linux Class by Mark A. Yoder