Beagleboard Android and SPI


I'm struggling to get spidev work properly on a Beagleboard rev. C4
running Android 2.3, Android Linux kernel 2.6.32.
So far I've patched the omap3_beagle_android_defconfig wih:


and activated spidev in board-omap3beagle.c (configured spi clk as

spidev3.0, spidev3.1 , spidev4.0 show up in /dev/spi* so far so good.

I have written a minor C program to test the spi functionality using
spidev and ioctl. I'm using write() and read() to write and read to
the spi device. write() works like a charm, but the problem is read().

Every one and then I'm getting a error message from the driver saying
"spidev spi4.0: RXS timed out". I can provoke the error by reading
several times in row, like


This does show the error message every time I run the program :frowning:

Further more I've been looking into the driver to see what causes this
error message, and it seems to be something to do with the driver
reading a status bit on the spi device, which indicates if the receive
buffer is full or empty. I have NO clue why this happens.
I was hoping someone could help me get pass this barrier?

Thanks in advance

Kasper Andersen


What Android-Port do you use? rowboat?

(How) did you setup the pinmux properly? (There is a trap with the SCK-Pin to be set as an input)


Quoting Kasper Andersen <>:

I'm using TI Android Gingerbread 2.3 DevKit 1.0 - rowboat
Pinmuxing is done in kernel as following:

static void __init omap3_beagle_init_spi4(void)
  printk(KERN_ERR "Using McSPI(4) for SPI\n");

  //set the pin muxes for SPI4
  omap_mux_init_signal("mcbsp1_clkr.mcspi4_clk", OMAP_PIN_INPUT); //
  omap_mux_init_signal("mcbsp1_fsx.mcspi4_cs0", OMAP_PIN_OUTPUT);
  omap_mux_init_signal("mcbsp1_dx.mcspi4_simo", OMAP_PIN_OUTPUT);
  omap_mux_init_signal("mcbsp1_dr.mcspi4_somi", OMAP_PIN_INPUT_PULLUP);

static void __init omap3_beagle_init_spi3(void)
  printk(KERN_ERR "Using McSPI(3) for SPI\n");

  omap_mux_init_signal("sdmmc2_clk.mcspi3_clk", OMAP_PIN_INPUT); //
  omap_mux_init_signal("sdmmc2_dat3.mcspi3_cs0", OMAP_PIN_OUTPUT);
  omap_mux_init_signal("sdmmc2_dat2.mcspi3_cs1", OMAP_PIN_OUTPUT);
  omap_mux_init_signal("sdmmc2_cmd.mcspi3_simo", OMAP_PIN_OUTPUT);

Quoting Kasper Andersen <>:

I've used TI Android Gingerbread 2.3 DevKit 1.0 - based on rowboat
My pinmux'ing is done in the kernel like this:

Well, this seems to me as if it were correct. In fact I'm doing the very same thing. The only point where I stumbeled was, that my Pinmux settings for SPI3 were overwritten by another piece of board-init code [1]. But that resulted in "no SCK in any case". I found this by checking pinmux settings after start of the kernel.

As your problems came by SPI4 I don't think it's the same issue. Do you get some SCK output during an SPI action?

What I not tried yet was reading from a C program (I was unable to find out how to compile a native application for android in a fast and easy way if you have me some pointers, I'd try it that way too). I just tested it for writing using spidev and the echo-command.


SCK is working as supposed for SPI operation. Both when reading and
Regarding native C programs for Android, it took me a minor struggle
to compile when tools needed
and setup the build environment. If you would like to try yourself,
here's a link
The first tip for success building the environment is to run your host
system on Ubuntu 10.04 64 bit. I never got it working with Ubuntu 11.

To spare you the trouble for compiling a native c program, I can send
you the same C program i'm running on the beagleboard, of your



The CLK signal output works fine, both when writing and sometimes
I'd had a minor struggle getting the Android build environment working
properly, but after trying again in Ubuntu 10.04 64bit (first try
Ubuntu 11 32bit without success) it worked. If you're interested
follow this link:

If you'd like to try I can send you my precompiled native c program,
to see how your SPI is operating?




Could you please send me the C program you are running to control the SPI from within Android? I’m very interested in how you are making it all work.