how to configure SPI for beaglebone AI?

388 views
Skip to first unread message

jayasudhaa t.n

unread,
Aug 4, 2020, 2:25:47 AM8/4/20
to BeagleBoard
hi,

i want to set up SPI on beagle bone AI.


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 ?


Dennis Lee Bieber

unread,
Aug 4, 2020, 1:26:46 PM8/4/20
to Beagleboard
On Mon, 3 Aug 2020 23:25:47 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user "jayasudhaa t.n"
<t.n.jayasudhaa-Re5...@public.gmane.org> wrote:

>i want to set up SPI on beagle bone AI.
>
>i followed this link https://elinux.org/BeagleBone_Black_Enable_SPIDEV
>
>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.
>

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.

Peruse
https://www.element14.com/community/roadTestReviews/3225/l/beaglebone-ai-review
(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)
https://www.element14.com/community/community/project14/visionthing/blog/2019/11/16/beagleboard-ai-brick-recovery-procedure



--
Dennis L Bieber

jayasudhaa t.n

unread,
Aug 4, 2020, 2:39:05 PM8/4/20
to BeagleBoard
hi,

yes i did this 

performed 

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

  1. dtb = am57xx-beagleboneai-roboticscape.dtb  


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.

Dennis Lee Bieber

unread,
Aug 4, 2020, 4:35:32 PM8/4/20
to Beagleboard
On Tue, 4 Aug 2020 11:39:04 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user "jayasudhaa t.n"
<t.n.jayasudhaa-Re5...@public.gmane.org> wrote:

>
> 1. dtb = am57xx-beagleboneai-roboticscape.dtb

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

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

uname_r=4.14.108-ti-r131
#uuid=
dtb=am5729-beagleboneai-roboticscape.dtb
cmdline=coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet

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

##enable x15: eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3-no-eeprom.sh
debian@bbai:~$
-=-=-

Reboot... Reconnect...

-=-=-
debian@bbai:~$ ls -l /dev/s*
crw------- 1 root root 10, 231 Aug 4 16:21 /dev/snapshot
crw-rw---- 1 root spi 153, 0 Aug 4 16:22 /dev/spidev1.0
crw-rw---- 1 root spi 153, 1 Aug 4 16:22 /dev/spidev1.1
lrwxrwxrwx 1 root root 15 Aug 4 16:21 /dev/stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Aug 4 16:21 /dev/stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Aug 4 16:21 /dev/stdout -> /proc/self/fd/1
-=-=-

Editing /boot/uEnv.txt to remove the use of that DTB (just commenting
it out) and rebooting...

-=-=-
uname_r=4.14.108-ti-r131
#uuid=
#dtb=am5729-beagleboneai-roboticscape.dtb
-=-=-
debian@bbai:~$ ls -l /dev/s*
crw------- 1 root root 10, 231 Aug 4 16:28 /dev/snapshot
lrwxrwxrwx 1 root root 15 Aug 4 16:27 /dev/stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Aug 4 16:27 /dev/stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Aug 4 16:27 /dev/stdout -> /proc/self/fd/1
-=-=-

and the system is back to no SPI device.


--
Dennis L Bieber

jayasudhaa t.n

unread,
Aug 4, 2020, 5:24:52 PM8/4/20
to BeagleBoard

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

On Tuesday, August 4, 2020 at 12:25:47 AM UTC-6, jayasudhaa t.n wrote:

Anand Prakash

unread,
Mar 6, 2021, 2:11:15 PM3/6/21
to BeagleBoard
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?

Reply all
Reply to author
Forward
0 new messages