Yet another SPI Post :)

Hello.

SPI. AGAIN.. DATE STAMP. 23 MARCH 2011. Wiki's. Outdated mostly.
If i get this running. I'll gladly update the wiki if given the
chance.
:slight_smile:

I will NOT use the Tin Can Tools trainer. I will use the BB-XM
Expansion header directly.
The Trainer-XM is out of stock.

Board: BB-XM Rev A.
OS: Angstrom. Generated using narcissus v.recently.
uImage: 2.6.32

My humble opinion on how use the onboard SPI.

STEP 1: PIN muxing. 2 ways. Kernel. Uboot.

I will use Uboot. It seems easier.

I have read on quite a few forums that the uboot source enables SPI on
the expansion
header by default.

But I checked Uboot src from here
http://git.denx.de/?p=u-boot/u-boot-ti.git;a=tree

board/ti/beagle/beagle.h

I don't see SPI on the pins. Please correct me if I'm wrong. *NOTE
Again* I will NOT use the Tincan trainer.
I'll copy the Tincan tools MUX most probably. Make any changes if I
want. and put them under
#define BEAGLE_XM ()\

git. clone. make.
and make a uboot.

After that.
STEP 2:

Koen has mentioned several times that the Angstrom Kernel enables
spidev by default.
Good.

I'll open Netbeans (toolchain already set up)

Use http://www.kernel.org/doc/Documentation/spi/spidev_test.c

Build. Run on the BBXM.
To test the spi.

I'll hopefully check the spi with a logic analyzer/oscilloscope
tomorrow.

If I'm wrong.
Kindly correct me.
If you think I'm on the right track.
Please tell me. That will be reassuring.

Thank-you.
:slight_smile:

I found success using the TRM and muxing my PINS from userland. The
program devmem2 allows you to access registers as well as change
values including PADCONF registers.

An update on my progress.
Very late. But still. For those who might stumble on this post later.

"SPIDEV" is not patched by default in images from narcissus.
One has to patch it in the kernel.
SPI Pins need to be muxed.

Go for http://www.angstrom-distribution.org/building-angstrom
Follow the steps to get an environment to build the kernel.

However, if you want a quick and dirty solution. Are happy with the
old kernel.
Just need SPI. (The way i did it btw)

Download/clone this http://gitorious.org/beagleboard-validation/linux/commits/beagleboardXM
(This is for xm. Most probably backwards compatible)
These are the kernel sources. 2.6.32.

Manually add lines in your kernel file to load spidev during startup.
Details of the patched lines here http://elinux.org/BeagleBoard/SPI
under 2.6.37 patch. The driver is there. Just have to tell the kernel
to load it.

Make sure in the beagle config of the kernel SPIDEV=y is written.

Then set Pinmux using u-boot.
Building uboot is simpler.

Download the latest stable uboot source from ftp://ftp.denx.de/pub/u-boot/
Building details are given in the Readme file.

Add the following in your beagle.h under your board model.

MUX_VAL(CP(MMC2_CLK), (IEN | PTU | DIS | M1)) /* MCSPI3_CLK
- I/P - MODE1*/\
MUX_VAL(CP(MMC2_CMD), (IDIS | PTU | DIS | M1)) /*MCSPI3_SIMO -
O/P - MODE1*/\
MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M1)) /*MCSPI3_SOMI -
I/P - MODE1 - PULLUP*/\
MUX_VAL(CP(MMC2_DAT2), (IDIS | PTU | DIS | M1)) /*MCSPI3_CS1 -
O/P - MODE1*/\
MUX_VAL(CP(MMC2_DAT3), (IDIS | PTU | DIS | M1)) /*MCSPI3_CS0 -
O/P - MODE1*/\
MUX_VAL(CP(MCBSP1_CLKR), (IEN | PTD | DIS | M1)) /*MCSPI4_CLK -
I/P - MODE1*/\
MUX_VAL(CP(MCBSP1_DX), (IDIS | PTD | DIS | M1)) /*MCSPI4_SIMO
- O/P - MODE1*/\
MUX_VAL(CP(MCBSP1_DR), (IEN | PTU | EN | M1)) /*MCSPI4_SOMI
- I/P - MODE1 - PULLUP*/\
MUX_VAL(CP(MCBSP1_FSX), (IDIS | PTD | DIS | M1)) /*MCSPI4_CS0
- O/P - MODE1*/\

Details here http://elinux.org/BeagleBoardPinMux#U-Boot