So I was working on my Raspberry Pi, getting SD cards and ethernet working over SPI so we can still use mass storage and networking while we rewrite the SD and USB drivers. I looked over at the side of my desk where all of this is on breadboard attached to my RPi and realised the insanity of it.
So let’s play spot the PCB:
- Raspberry Pi. This one’s easy!
- SparkFun FTDI Basic Breakout – 3.3V
- SparkFun Breakout Board for microSD Transflash
- SparkFun DeadOn RTC
- SparkFun Real Time Clock Module
- Olimex ENC28J60-H
- SparkFun PCA9306 Level Translator Breakout
- SparkFun Digital Temperature Sensor Breakout – TMP102
- SparkFun SOIC to DIP Adapter 20-Pin with 2x Atmel AT45DB161D
- Gadget Factory / Dangerous Prototypes Open Bench Logic Sniffer
Phew!
And yes, my Raspberry Pi has two SD cards and two ethernet controllers connected. The kernel and device tree blobs are loaded from the built-in SD and the root filesystem from the SPI SD card. The internet ethernet doesn’t work at the moment because we don’t have a USB driver in this kernel, so the SPI ethernet does the job for now!
Cool! Nice job. Do you have some of your SPI / I2C code to share with us? I made a post on the Raspberry Pi forum using your kernel extensions and some Python code. I’m just curious how you worked things out. Thanks!
So far I am only using the in-kernel drivers for everything – there isn’t really any special code to show other than what’s already in my git tree. The magic happens when you tell the kernel to wire up the SPI controller to this and that SPI device driver, and then things just work! 🙂
Good job, 3.2.20 is running just fine on my Pi. Thanx 🙂
But – could you just give a hint on how to get the SPI SD card running? I have a sparkfun SD breakout here, and i hope i got the wiring correct.
spidev driver is loading, /dev/spidev… is present
mmc_spi driver also loads without complaints, but nothing else happens. What am i missing?
Because the mmc_spi is a kernel-level driver for SPI peripherals it needs wiring up to the SPI subsystem from within the kernel. You’d have to edit arch/arm/mach-bcm2708/bcm2708.c to change what is bound to the SPI at the very least, and perhaps also provide extra data to the mmc_spi driver – then recompile the kernel – for it to work.
The Latest 3.2 Kernel (3.2.23 r1 built on 2012-07-15) whether included the mmc_spi driver?
Thanks for the examples you’ve provided. I have the same SparkFun DS1307 RTC board. Did you use a level converter to connect it?
Yes I use the PCA9306 to hook it up.
Thanks, that looks like a handy part. I only have their logic level converter (http://www.sparkfun.com/products/8745) so I’ll try with that.