Help with Enabling SPI?

Hi everyone,

I want to enable SPI0 on beaglebone black, and I’ve been following resources online:

http://elinux.org/BeagleBone_Black_Enable_SPIDEV

after changing uEnv.txt and rebooting bbb however, bbb doesn’t come back online. All 4 of the usr LEDs are on, and I can no longer connect back to beaglebone.

Firstly, a few clarifications, in My Computer > BeagleBone Getting Started, I did not find any uEnv.txt file, but nfs-uEnv.txt. The contents of nfs-uEnv.txt are:

##Rename as: uEnv.txt to boot via nfs
##https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt
##SERVER: sudo apt-get install tftpd-hpa
##SERVER: TFTP_DIRECTORY defined in /etc/default/tftpd-hpa
##SERVER: zImage/.dtb need to be located here:
##SERVER: TFTP_DIRECTORY/zImage
##SERVER: TFTP_DIRECTORY/dtbs/
.dtb
##client_ip needs to be set for u-boot to try booting via nfs
client_ip=192.168.1.101
#u-boot defaults: uncomment and override where needed
#server_ip=192.168.1.100
#gw_ip=192.168.1.1
#netmask=255.255.255.0
#hostname=
#device=eth0
#autoconf=off
#root_dir=/home/userid/targetNFS
#nfs_options=,vers=3
#nfsrootfstype=ext4 rootwait fixrtc

In the embedded-linux blog, he suggested to delete everything in the file and put in

optargs=quiet drm.debug=7 capemgr.enable_partno=BB-SPI0-01

I however followed the instructions from elinux, and just copied the the above line. After that, I changed the name of the file from nfs-uEnv.txt to just uEnv.txt and rebooted bbb by typing reboot on the terminal, and now I don’t think bbb works.

Any ideas on what I’m doing wrong?

Thanks.

Delete any lines that may appear in uEnv.txt and add the following and save. This change will tell the board to apply the SPI0 Device Tree Overlay we created on startup.

The above is very, very bad advice. The uEnv.txt is a very important file for booting the beaglebone black( or any beagle hardware ), and arbitrarily deleting lines from, or the whole file is not very smart at all. I would suggest in the future to avoid any advice, guide, or whatever from that blog site.

So, if you board is now in an unbootable state, you’re options are rather limited. In either case, you will need an sdcard, with either a standalone, or flashing image on it. Then boot from that. With a standalone image, you’ll have to reinstate the uEnv.txt file back to the original contents before you followed that bad advice from that blog site. If you do not know how to do this, then perhaps your best option is to reflash the entire eMMC.

If you have data on the eMMC that you need / want to keep. You can back that up fairly easily before reflashing . . .

After that, I changed the name of the file from nfs-uEnv.txt to just uEnv.txt and rebooted bbb by typing reboot on the terminal, and now I don’t think bbb works.

Ok, I missed this part originally. Yes, you’re attempting to boot from an nfs share, so unless you have an nfs share, setup exactly like how is implied in the uEnv,txt file. Changing nfs-uEnv.txt to uEnv.txt without modification will fail.

I’ve had this problem myself. If you are using NFS and systemd, then you must prevent connman from managing eth0:

In /lib/systemd/system/connman.service, add -I eth0 to the connmand line

Regards,
John

Hi John,

Thanks for your reply. I’m new to linux systems, much less embedded linux systems.

How would I know if I’m using NFS and systemd? I’m currently in the processing of flashing bbb, so I don’t know if this new version of bb will be the same as before.

Also, I thought enabling the SPI was an internal process? From what I’ve been reading about NFS and connman they talk about internet connections etc. I’m a bit confused. What’s the difference between uEnv.txt vs nfs-uEnv.txt?

Thanks!

Hi William,

Thanks for your reply. I’m trying to flash bbb now. Could I ask what’s the difference between flashing an image vs flashing the eMMC? I thought flashing the bbb meant flashing everything.

I do not currently have anything that I want to keep on bbb. What’s the difference between booting from an nfs share vs booting normally?

Also, what do you suggest I do in the future? I didn’t follow the blog guy’s advice and had simply added the line, although I did change the file name from nfs-uEnv.txt to uEnv.txt. Should I leave the file name as nfs-uEnv.txt next time?

Thanks.

Hi William,

Thanks for your reply. I’m trying to flash bbb now. Could I ask what’s the difference between flashing an image vs flashing the eMMC? I thought flashing the bbb meant flashing everything.

Flashing the eMMC is flashing everything.

I do not currently have anything that I want to keep on bbb. What’s the difference between booting from an nfs share vs booting normally?

Also, what do you suggest I do in the future? I didn’t follow the blog guy’s advice and had simply added the line, although I did change the file name from nfs-uEnv.txt to uEnv.txt. Should I leave the file name as nfs-uEnv.txt next time?

Thanks.

Don’t bother with NFS shares for now. They’re fairly complicated, and quite honestly you do not sound like you’re experienced enough with linux yet. But the difference is, NFS boot is “booting” over a network. Or if you prefer it is loading the root file system over a network.

In the future you should make a backup of any important files, or those you’re not sure of.

I agree with William, best to stay with everything on an SDCard for now. NFS is an acronym for Network File System and means that instead of the Debian OS residing on the SDCard, it is placed on your NFS Server (which can be your Linux desktop) and when your BBB boots, it loads the Debian OS over the network rather than reading it from the BBB SDCard.

Regarding the SPI, it is enabled using the DeviceTree. When the BBB boots, it loads a preconfigured DeviceTree and some peripherals are enabled, which others are disabled. To modify the bootable DeviceTree is complicated, but you can always enable individual peripherals by dynamically loading a DeviceTree definition. You will find those definitions here:

https://github.com/RobertCNelson/bb.org-overlays

Regards,
John

Hi William and John,

I managed to get the SPI enabled! Instead of changing the uEnv/nfs-uEnv files, I stopped at the step right before and ran the test to check if the SPI was enabled, and it was.

Thanks for all of your help!