On Mon, 16 Jul 2018 19:58:51 -0700 (PDT), Jinao Gao
<gaojinao@gmail.com> declaimed the following:
I was trying to follow this link
first: BeagleBone Black Enable SPIDEV - eLinux.org
Then I found it was too old. Then I followed a book named Exploring
BeagleBone, apparently it was too old as well. Then I saw a video on
youtube, he was using Debian 8.6 but still did not work. Currently I am
pretty confused about what I need to set before running SPI code.
First thing -- ignore ALL those old instructions.
<SNIP>
What did you try? Which kernel? Are you trying to use SPIDEV or another
SPI driver? Does the /dev/spidevX.X interface show up already for the SPI
you want?
Our goal with the latest images is to:
1) have the spidev show up by default,
2) allow overlays to disable the spidev for a native SPI driver as needed,
and
3) use ‘config-pin’ to dynamically enable the right pinmux mode for the
used pins.
Did the instructions you followed comprehend these elements of the setup
and what enables them? The spidev must be enabled in the base device tree
or an overlay for (1). The overlays must be applied in u-boot, not the
kernel capemgr, for (2). The pinmux helpers must be enabled and named
properly to match the config-pin script for (3).
If I understand Mr. Kridner, recent releases should have SPI device
available without doing anything...
This is from the January LXQT image (Debian Stretch 9.3
https://debian.beagleboard.org/images/bone-debian-9.3-lxqt-armhf-2018-01-28-4gb.img.xz
) on my BBB eMMC:
debian@beaglebone:~$ uname -a
Linux beaglebone 4.9.78-ti-r94 #1 SMP PREEMPT Fri Jan 26 21:26:24 UTC 2018
armv7l GNU/Linux
debian@beaglebone:~$ ls -la /dev/sp*
crw-rw---- 1 root spi 153, 1 Jul 12 16:36 /dev/spidev1.0
crw-rw---- 1 root spi 153, 0 Jul 12 16:36 /dev/spidev1.1
crw-rw---- 1 root spi 153, 3 Jul 12 16:37 /dev/spidev2.0
crw-rw---- 1 root spi 153, 2 Jul 12 16:37 /dev/spidev2.1
debian@beaglebone:~$
debian@beaglebone:~$ sudo config-pin p9_21 spi
debian@beaglebone:~$ sudo config-pin p9_18 spi
debian@beaglebone:~$ sudo config-pin p9_17 spi
Invalid mode: spi
debian@beaglebone:~$ sudo config-pin p9_22 spi
Invalid mode: spi
debian@beaglebone:~$ sudo config-pin p9_17 spi_cs
debian@beaglebone:~$ sudo config-pin p9_22 spi_sclk
debian@beaglebone:~$
... Seems to do for spi0 (on the old pinout diagrams). But spi1 doesn't
seem to be configured.
debian@beaglebone:~$ sudo config-pin p9_30 spi
debian@beaglebone:~$ sudo config-pin p9_29 spi
P9_29 pinmux file not found!
bash: /sys/devices/platform/ocp/ocp*P9_29_pinmux/state: No such file or
directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp*P9_29_pinmux/state
debian@beaglebone:~$ sudo config-pin p9_28 spi_cs
P9_28 pinmux file not found!
bash: /sys/devices/platform/ocp/ocp*P9_28_pinmux/state: No such file or
directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp*P9_28_pinmux/state
debian@beaglebone:~$ sudo config-pin p9_31 spi_sclk
P9_31 pinmux file not found!
bash: /sys/devices/platform/ocp/ocp*P9_31_pinmux/state: No such file or
directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp*P9_31_pinmux/state
debian@beaglebone:~$
Interesting: Following Mr. Nelson's original reply regarding activating
an overlay and rebooting resulted in only
debian@beaglebone:~$ ls -la /dev/spi*
crw-rw---- 1 root spi 153, 1 Jul 17 10:23 /dev/spidev1.0
crw-rw---- 1 root spi 153, 0 Jul 17 10:23 /dev/spidev1.1
debian@beaglebone:~$
/and/ wiped out most of the pinmux files at the same time. Took it out and
reboot shows all "four" entries. Looking at the config-pin source, the
three that failed above default assignment is "audio" which may have taken
control away from config-pin (part of HDMI?).
How to use those is another matter -- I don't have a set up to work
with it...