Home > Project > Progress! SPI is working on the BeagleBoard-xM

Progress! SPI is working on the BeagleBoard-xM

As a first step to writing a Linux SPI device driver for the Maxim 7221 LED display driver chip I decided to at least prove that I can get SPI working on the BeagleBoard-xM with the BeagleBoard-xM Trainer Expansion Board which provides level translated SPI and GPIO pins.

To get this to work I had to do the following:

  1. Patch the Linux Kernel 2.6.32 BeagleBoard board specific arch/arm/mach-omap2/board-omap3beagle.c so that the SPI pins get configured correctly and the SPIDEV driver is made aware of the SPI devices on the board. For the patch information see this page.
  2. Once the kernel was patched I used the Angstrom distribution OpenEmbedded build environment to re-build the kernel.
  3. Build the spidev_test.c program that is part of the Documentation/spi tree in the linux kernel source using a cross compiler built using the crosstool-ng cross compiler build system.
  4. Load the spidev_test executable onto the Beagleboard-xM

With everything set up and ready to go it was time to boot BeagleBoard-xM and verify that the required SPI devices appeared in the /dev directory. Upon booting I was very happy to see the following:

root@beagleboard:/# ls /dev/spi*
/dev/spidev3.0 /dev/spidev3.1 /dev/spidev4.0

With the spidev devices being present it was time to see if they actually worked! So I hooked up my USBee SX logic analyzer to the Trainer boards McSPI4 pins and ran the spidev_test program. What the logic analyzer saw was exactly what the spidev_test program was sending! I’ve now verified that I can communicate with SPI devices using the kernels SPIDEV driver.

The spidev_test program sends the following data:


uint8_t tx[] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x40, 0x00, 0x00, 0x00, 0x00, 0x95,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xDE, 0xAD, 0xBE, 0xEF, 0xBA, 0xAD,
0xF0, 0x0D,
};

You can see from the following screen shot that the data was properly transmitted via the SPI:

Click the image to view full size.

And here are some images of the BeagleBoard-xM set up with the Trainer card and the USBee logic analyzer attached:

Click on image to see full size.

 

Click on image to see full size.

 

The next step is to write some code to put the SPI LED display through it’s paces.

 

  1. November 24th, 2011 at 08:24 | #1

    Does this verify both MOSI and MISO? I am having trouble with MISO on my master device. spidev_test returns zeros when I tie MOSI and MISO together.

  2. murathan
    January 12th, 2012 at 14:42 | #2

    hi,
    I did all the steps and ran spidev. However, the data could not see Usbee. Is it relevant to the CLK input is set? Do I need to give the CLK outside?.

  3. January 28th, 2012 at 22:10 | #3

    I’ve been to your website before. The extra I study, the extra I maintain coming once more!

  4. murathan
    February 13th, 2012 at 15:50 | #4

    Hi Jim,

    I think I’ve tried everythink but it haven’t worked.http://www.veriyolu.net/murathan/ it’s what i saw
    If possible, can you send me u-boot and uImage that you use. If not, do you give name of kernel you use.

  5. February 21st, 2012 at 01:45 | #5

    It’s appropriate time to make some plans for the future and it’s time to be happy. I have read this post and if I could I desire to suggest you few interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it!

  6. March 1st, 2012 at 03:00 | #6

    I am transient on scenario now, accordingly proclivity to cede your straightforward invisible cable concrete till solve. However seems to be rocking. Your writing adorableness is largely ego trip.I had nearly inclined progress my search, at-final I trigger the break. here. Thx character that the nice enlargement playmate.

  7. March 12th, 2012 at 06:14 | #7

    Superior setup, thanks for the help. This helped me huge time with my decision.

  8. March 14th, 2012 at 00:10 | #8

    Magnificent beat ! I would like to apprentice while you amend your website, how can i subscribe for a blog website? The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided bright clear idea

  9. March 14th, 2012 at 22:41 | #9

    Just desire to say your article is as amazing. The clarity in your post is simply cool and i can assume you’re an expert on this subject. Well with your permission let me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please continue the gratifying work.

  10. November 13th, 2012 at 20:33 | #10

    Aw, this was a really nice post. In concept I would like to put in writing like this additionally – taking time and actual effort to make an excellent article… but what can I say… I procrastinate alot and in no way appear to get one thing done.

  11. November 17th, 2014 at 11:26 | #11

    Hello,

    No you shouldn’t need to use an external clock.

  1. No trackbacks yet.