[beagleboard] Trouble setting up SPI

Where did the Python for the SPI come from?

from the gigamegablog link
http://www.gigamegablog.com/2012/09/09/beaglebone-coding-101-spi-output/
ultimately from
http://elk.informatik.fh-augsburg.de/da/da-49/trees/pyap7k/lang/py-spi/

Ok, I think you might actually be setting up spi0 (by SRM) but spi1 (by Linux), confusing I know, but stick your oscilloscope into P9-22 and see what you get.

Apologies, I just double checked and I think you're ok.

I go back to my previous suggestion, I would try not using the python code and try using the spidev_test program.

http://lxr.linux.no/#linux+v3.8.13/Documentation/spi/spidev_test.c

Can I compile that on the beaglebone (if so what options do I need to give gcc?)

One thing I just discovered trying to figure out the state of the pinmux

$ cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins


pin 100 (44e10990): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 101 (44e10994): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 102 (44e10998): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 103 (44e1099c): (MUX UNCLAIMED) (GPIO UNCLAIMED)

and to verify there is a group for the pins

cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pingroups

group: spi1_pins_s0
pin 100 (44e10990)
pin 101 (44e10994)
pin 102 (44e10998)
pin 103 (44e1099c)

it seems like the pinmux isn’t getting configured properly, right?

I just tried to apply a dts for spi0, and pinmux-pins has this in it, good sign.

pin 84 (44e10950): 48030000.spi (GPIO UNCLAIMED) function spi0_pins_s0 group spi0_pins_s0
pin 85 (44e10954): 48030000.spi (GPIO UNCLAIMED) function spi0_pins_s0 group spi0_pins_s0
pin 86 (44e10958): 48030000.spi (GPIO UNCLAIMED) function spi0_pins_s0 group spi0_pins_s0
pin 87 (44e1095c): 48030000.spi (GPIO UNCLAIMED) function spi0_pins_s0 group spi0_pins_s0

And even better I get a pulse train on P9-22 with the python bindings!

So, I think I have what I need to make my current project work, but I’m very curious about why spi0 works and spi1 doesn’t, and I don’t understand device trees enough to figure it out on my own. I’ve attached the two dts files if anyone wants to take a look.

Thanks,
Shamus

spi0.dts (1.02 KB)

spi1.dts (1.15 KB)

To anyone reading this that has a problem with getting SPI1 working while SPI0 is working, there is a conflict between the
audio of the HDMI framer and SPI1. The pins are shared and so the audio on the HDMI framer must be disabled.

There is a patch pending for the kernel that will split the HDMI overlay into audio and video so that the
audio part can be disabled on the (kernel) command line so the conflict is resolved.

See the update in this post for further details: http://hipstercircuits.com/enable-spi-with-device-tree-on-beaglebone-black-copy-paste/#comments