So I've had some time to try and get SPI working on fresh installation of piCore 5.0alpha4, but have run into the same problem I had before, that is the SPI kernel modules appear to be present and loaded but there are no SPI devices being created in /dev.
The i2c driver modules are loading correctly and appear as /dev/i2c-0 and /dev/i2c-1 but the SPI driver isn't playing ball
Here's the output from lsmod:
tc@box:~$ lsmod
Module Size Used by Not tainted
i2c_dev 5659 0
spidev 5677 0
squashfs 28699 45
spi_bcm2708 4779 0
i2c_bcm2708 3949 0
Both the spi_bcm2708 and spidev drivers are present and loaded, as are the i2c driver modules, so I am expecting to see /dev/spidev0.0 and /dev/spidev0.1 like I see the i2c devices but the SPI devices are not there.
tc@box:~$ ls /dev/i2c*
/dev/i2c-0 /dev/i2c-1
tc@box:~$ ls /dev/spi*
ls: /dev/spi*: No such file or directory
tc@box:~$
I've tried to understand what's stopping the SPI devices from working, and the best I can come up with is that the devices in /dev haven't been created using something like mknod or MAKEDEV or udev - but just how I'm not sure!
I'm confused as to what to do to create the device files, from what I've read MAKEDEV should do it automagically but isn't installed (and I can't locate it in other extensions). mknod seems like it should do the trick manually, but other messages in the TCL forums suggest that I should be using udev to create devices but aren't much help beyond that.
I've searched for hints on how to get SPI working and came across some information here
http://www.brianhensley.net/2012/02/python-controlling-spi-bus-on.html that lead me here
https://www.kernel.org/doc/Documentation/spi/spidev which suggests that managing the /dev character device by hand is a bad idea, I should be using udev or mdev (which isn't part of busy box in this release)
I've tried to look into how to use udev, which is installed, but I was lost in the detail pretty quickly.
So I've attempted to create the device files manually, but it doesn't seem to have worked. I've looked up the SPI driver major number (153) in the Raspberry Pi kernel source and in the kernel source file /Documentation/devices.txt and it's a character device, so I tried:
tc@box:~/vfd$ sudo mknod /dev/spidev0.0 c 153 0
This creates the device /dev/spidev0.0 but it doesn't work when I try and open the device:
tc@box:~/vfd$ sudo ./spidev_test
can't open device: No such device or address
Aborted
And for completeness, spidev_test.c contains the following lines:
static const char *device = "/dev/spidev0.0";
....
fd = open(device, O_RDWR);
if (fd < 0)
pabort("can't open device");
The spidev_test.c code has worked for me previously on Raspbian.
Any ideas what to try next?