how to configure SPI for beaglebone AI?


i want to set up SPI on beagle bone AI.

i followed this link

but it doesnt work as this step fails:

 echo BB-SPI1-01 > /sys/devices/bone_capemgr.*/slots

Also config-pin utility doesnt work. it says Pin mux file not present.

Can anyone provide step by step procedure ?

Correct. The BB AI does NOT SUPPORT run-time configuration of the
pin-mux (it may allow for changing direction and pull-up/down state for
pins currently muxed as GPIO, but does not allow changing the pin mode to
some other system).

  You will have to, at the least, modify /boot/uEnv.txt to load different
device tree (overlays) to enable SPI. You may even have to edit and compile
device trees to enable some functions.

(note: this page appears to rely upon making a copy of the original device
tree and then copying the roboticscape device tree over the original; I'm
pretty certain one could just edit uEnv.txt and replace the device tree
file name in that for the same effect)


yes i did this


To enable it set a line in the /boot/uEnv.txt:

+ expand sourceview plain

when i did that , beagle bone doesnt boot up.
hence i reflashed the fresh image and reverted all changes to the boot file.

Updating the device tree

Out of the box the BBAI pins do not support the SPI bus. So why not? To fix this one has to edit the device tree.

Checking under boot/dtb where the compiled device tree file are shows there are 2 dtb for BBAI.

One is for the plain BBAI, the other for BBAI robotics cape.

To make sure I checked the dts file on github which confirms that the vanilla DTB on the BBAI does not have any configurations for the SPI bus.

After overwriting the BBAI with the BBAI robotics cape .dtb and rebooting there are now two SPI busses available as shown on the photo below.

Really? My system has am5729-beagleboneai..., NOT am57xx-...

  After editing...

i changed the image file and followed the same steps as you mentioned . it worked. thank you so much

Hi All,

I am working on enabling the SPI on BBAI. I tried the roboticscape dtb file and could see the spidev1.0 and spidev1.1 in the /dev folder.
However, when I run the spidev_test. I receive stream of 0x00 instead of the actual data. I bridged pin 9.29 and 9.30 to test spi interface.

Did anyone try executing spidev_test after enabling the roboticscape dtb file?