Where is the SpiDev test program?

I have shored out my data pins on P9 and I keep seeing tutorials and code running SpiDev test program? I’ve tried to run and it says no files exists. Where are people getting this file?

I have shored out my data pins on P9 and I keep seeing tutorials and code
running SpiDev test program? I've tried to run and it says no files exists.
Where are people getting this file?

spidev_test.c is available from kernel.org

https://www.kernel.org/doc/Documentation/spi/spidev_test.c

There's also a version for the BBB that can be found in Derek Molloy's
repository for his book:

git clone GitHub - derekmolloy/exploringBB: Source code for the book Exploring BeagleBone, by Derek Molloy (see www.exploringbeaglebone.com)
then look for ../exploringBB/chp08/spi/spidev_test.c

Thanks Bill! What about the header files below? I’m getting errors on some of the global variables and I think its because I don’t have these header files.

#include <linux/types.h>

#include <linux/spi/spidev.h>

Thanks Bill! What about the header files below? I'm getting errors on some
of the global variables and I think its because I don't have these header
files.

#include <linux/types.h>

#include <linux/spi/spidev.h>

http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Installing_kernel_headers

I’m running the command to install the header files, but I’m coming up with errors.

sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading stat information... Done
E: Unable to locate package linux-headers-3.8.13-bone72
E: Couldn't find any package by regex 'linux-headers-3.8.13-bone72'

I ran the kernel upgrade before this too. Any ideas?

What's your base rootfs?

cat /etc/dogtag

debian@beaglebone:~$ sudo apt-cache search linux-headers-3.8.13-bone72
linux-headers-3.8.13-bone72 - Linux kernel headers for 3.8.13-bone72 on armhf

Regards,

BeagleBoard.org BeagleBone Debian Image 2014-04-23

I ran the search and nothing happened.

Sorry, that apt repo was initially setup July of 2014, so it's not
enabled in the original May 2014 image.

wget http://repos.rcn-ee.com/debian/pool/main/l/linux-upstream/linux-headers-3.8.13-bone72_1wheezy_armhf.deb
sudo dpkg -i linux-headers-3.8.13-bone72_1wheezy_armhf.deb

or update the rootfs:

http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#2015-03-01

Regards,

Thank you! That worked perfectly. I’m still having trouble compiling my spidev_test.c program though. There is a lot of undeclared variables like SPI_TX_DUAL and SPI_RX_DUAL. I thought these would be included when I downloaded the header file, but I’m not seeing the directory for this in my beaglebone. According to the code it should be </linux/types.h> and </linux/spi/spidev.h>.