Beagleboard xM - SPI

1,061 views
Skip to first unread message

Vasilis

unread,
Jan 31, 2012, 6:47:25 PM1/31/12
to Beagle Board
Hey all and thanks for the support. I am a student and I use
Beagleboard xM for the first time.

What I want to do is to establish an SPI communication between a PIC
microcontroller and Beagleboard xM, running on Angstrom. For this
reason, I tried to patch the kernel and recompile it, following
instructions from here: http://linuxdeveloper.blogspot.com/2011/10/enabling-spi-on-beagleboard-xm.html

However, when I try to compile the new kernel with the command

$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage

I keep getting this message: Error: selected processor does not
support ARM mode `smc #0'

Does anyone have an idea of what I should try to fix it? I am running
xUbuntu 11.10 Oneiric Ocelot on my development machine.

Thank you in advance!

Brian Hutchinson

unread,
Jan 31, 2012, 8:02:02 PM1/31/12
to beagl...@googlegroups.com
I don't think you need to go patching anything as long as you are
using an up-to-date kernel. You just have to make sure spidev is
turned on in the .config and then in say board-omap3beagle.c setup a
platform driver for the McSPI channel you want. Setup pinux in the
kernel or u-boot for the McSPI channel you want.

Check out:
http://elinux.org/BeagleBoard/SPI

I'm running the latest 3.0 based kernel and I'm running a spi display
on McSPI3 and I didn't have to patch anything.

Regards,

Brian

Vasilis

unread,
Feb 1, 2012, 8:25:35 AM2/1/12
to Beagle Board
Thank you for your quick reply! I am running a 2.6.32 kernel and I
installed Angstrom with a Narcissus build, using these instructions:
http://treyweaver.blogspot.com/2010/10/installing-angstrom-on-beagleboard-xm.html
. Should I do something different to enable SPI? How can I generally
configure pinux?

Brian Hutchinson

unread,
Feb 1, 2012, 9:05:41 AM2/1/12
to beagl...@googlegroups.com
On Wed, Feb 1, 2012 at 8:25 AM, Vasilis <vasilis...@gmail.com> wrote:
> Thank you for your quick reply! I am running a 2.6.32 kernel and I
> installed Angstrom with a Narcissus build, using these instructions:
> http://treyweaver.blogspot.com/2010/10/installing-angstrom-on-beagleboard-xm.html
> . Should I do something different to enable SPI? How can I generally
> configure pinux?

I haven't used Narcissus lately but I would think you could pull down
images (and a ready to go toolchain) based on the latest 3.0 kernel,
that way you don't have to patch anything for McSPI.

I usually just work with bitbake and the git repositories. It may
appear overwhelming, but it would be better to run with a new kernel
and if you can't get it from Narcissus then you can clone the git
repository and use bitbake to make whatever image or package you need.
See http://www.angstrom-distribution.org/building-angstrom Koen has
made scripts that makes it easy to clone everything and get setup for
you to type bitbake <something>. I usually start out with bitbake
console-image which will build u-boot, kernel, and a small basic root
filesystem that you just have to populate these images on the SD Card.

To setup your SPI, you are going to have to modify
arch/arm/mach-omap2/board-omap3beagle.c to add that platform driver
struct etc. in the elinux spi link I sent you to setup the particular
McSPI channel you want to use.

If you poke around the elinux site, you will find all kinds of good
info on how to do things with the beagleboard. You can change pinmux
in u-boot or the kernel and the elinux site had examples of how to do
both.

Don't shy away from using bitbake with Angstrom or even Yocto (both
use OE (OpenEmbedded) meta data. It takes effort to get your head
around but the benefits are well worth it.

I'm just giving you the 30,000 foot overview here.

Welcome to Embedded Linux!

Hopefully others will chime in if I'm sending you in the wrong direction.

Regards,

Brian

Vasilis

unread,
Feb 1, 2012, 9:51:03 AM2/1/12
to Beagle Board
Thank you very much for your answer! As for Narcissus, is there a
special configuration I should do when I build, so that SPI drivers
are enabled? I am confused and the options for advanced build doesn't
seem helpful at all...

Brian Hutchinson

unread,
Feb 1, 2012, 11:24:10 AM2/1/12
to beagl...@googlegroups.com

Whatever you do, you are going to need the source so you can rebuild
the kernel. It won't help you to have Narcissus build you an image
because you need to make modifications to it. If you get a recent
kernel, it has support for all the McSPI's.

The default .config for the kernel in Angstrom usually already has
CONFIG_SPI_SPIDEV=y set. So you will just have to add the platform
driver to config the McSPI channel you want to use as in the elinux
SPI example. You also need to setup pinmux according to the McSPI


channel you want to use.

I assume you are going to be hooking to the expansion connector. If
you look in the beagle board system reference manual, each of those
pins can have many different functions. So you setup pinmux to give
the pins the function you want.

I don't know which BB you have but the system reference manuals to all
of them are here http://beagleboard.org/

Regards,

Brian

Vasilis

unread,
Feb 1, 2012, 12:36:21 PM2/1/12
to Beagle Board
I see. So from the useful information you offered me, what I figured
out is the following:

1) I install the mandatory packages from this site so that
OpenEmbedded works : http://wiki.openembedded.org/index.php/OEandYourDistro

2) I build Angstrom using these advice : http://www.angstrom-distribution.org/building-angstrom

3) I make the appropriate configurations for SPI and build a uImage.

What is the final step for booting the BB xM? Sorry for asking a lot
of stuff but I really want to be sure that it will work since I try
something new.
Thank you a lot!

Brian Hutchinson

unread,
Feb 1, 2012, 5:58:09 PM2/1/12
to beagl...@googlegroups.com

Once you have all the images - MLO, u-boot.bin, uImage ... you will put these images on the FAT32 partition of the SDCard.  There should be directions on elinux for doing that.  The root filesystem files will be untared to a ext3/4 filesystem.  Again, elinux has the info.

Your user app will use the /dev/spidev device.

Again, this is high level, you'll have to dig through elinux for the details.

Regards,

Brian

From Droid Incredible.

Vasilis

unread,
Feb 1, 2012, 6:03:54 PM2/1/12
to Beagle Board
I think I'll make it through! Thank you again!! I will come back with
any news on that process!

Vasilis

unread,
Feb 1, 2012, 6:11:05 PM2/1/12
to Beagle Board
In fact I would like to ask something last... If I make it work, I
guess that Trainer Board or something of the same style is needed for
the TTL level translation, isn't it?

Brian Hutchinson

unread,
Feb 1, 2012, 6:38:44 PM2/1/12
to beagl...@googlegroups.com

The tincan tools board would make it easier and less prone to smoke something.

Vasilis

unread,
Feb 1, 2012, 7:08:09 PM2/1/12
to Beagle Board
This one: https://www.tincantools.com/product.php?productid=16151&cat=0&page=1&featured
I had in mind too. Thank you very much indeed, I appreciate your
help!!

Brian Hutchinson

unread,
Feb 1, 2012, 7:41:52 PM2/1/12
to beagl...@googlegroups.com

Yes, that one will work. The BeagleBoard expansion header signals are
1.8V so you'll have to translate to whatever voltage the SPI device
you are attempting to hook up uses. The tincan tools trainer boards
have the voltage level stuff you'll need and a nice breakout board
area for your circuits.

They didn't have these when I did my first BB project ... a EE friend
that was working on the same project had to make basically the same
thing as the trainer board to do the level shifting ... so these
trainer boards are nice and make things a lot easier. They make a
cool JTAG (Flyswatter) debugger interface that works with OpenOCD too.

Regards,

Brian

Vasilis

unread,
Feb 1, 2012, 8:05:47 PM2/1/12
to Beagle Board
I see...I also had in mind to start searching around for such a
translator circuit, but since this board does the dirty work, it's not
worth of it...It is very cheap too!

On Feb 2, 2:41 am, Brian Hutchinson <b.hutch...@gmail.com> wrote:
> On Wed, Feb 1, 2012 at 7:08 PM, Vasilis <vasilis.vasi...@gmail.com> wrote:
> > This one:https://www.tincantools.com/product.php?productid=16151&cat=0&page=1&...

Vasilis

unread,
Feb 2, 2012, 6:55:14 PM2/2/12
to Beagle Board
Hello again! I didn't make it out with OpenEmbedded as I get parsing
errors when I am trying to build the MLO file...Seriously is this the
only way I can get SPI working? I saw that in Beagleboard demo files
(http://www.angstrom-distribution.org/demo/beagleboard) there is a new
kernel (3.0.17)... Can I take advantage of that and build somehow a
new kernel?

Brian Hutchinson

unread,
Feb 2, 2012, 7:05:39 PM2/2/12
to beagl...@googlegroups.com
On Thu, Feb 2, 2012 at 6:55 PM, Vasilis <vasilis...@gmail.com> wrote:
> Hello again! I didn't make it out with OpenEmbedded as I get parsing
> errors when I am trying to build the MLO file...Seriously is this the
> only way I can get SPI working? I saw that in Beagleboard demo files
> (http://www.angstrom-distribution.org/demo/beagleboard) there is a new
> kernel (3.0.17)... Can I take advantage of that and build somehow a
> new kernel?

If it includes the source for the kernel and a cross toolchain to
rebuild it ... then yes. If it is just a kernel image, then no ...
unless someone registered a SPI platform driver in the image. If you
do a ls of /dev/ and see a device called spidevX.X then the kernel has
a SPI driver configured (now you have to figure out which pins it is
using). If you don't see that then you have to modify the kernel code
to register the SPI driver (the elinux SPI example) so the device
shows up in /dev for your userspace app to use.

So with OE, you got to the point where you had all the repos cloned
and an environment setup and were able to do something like bitbake
console-image and MLO failed to build?

Regards,

Brian

Vasilis

unread,
Feb 2, 2012, 7:15:17 PM2/2/12
to Beagle Board
I created a folder which, after configuration, contains openembedded,
bitbake, pixhawk and build subfolders. Then I tried to bitbake x-load
but keeps sending a parsing error message. As for the demo beagleboard
repository I linked, there is a uImage of 3.0.17 kernel but when I
download the rootfs, under /boot directory there is a 2.6.32 uImage.
This is what confuses me...Thanks for your patience!

On Feb 3, 2:05 am, Brian Hutchinson <b.hutch...@gmail.com> wrote:

Brian Hutchinson

unread,
Feb 3, 2012, 9:41:10 AM2/3/12
to beagl...@googlegroups.com
On Thu, Feb 2, 2012 at 7:15 PM, Vasilis <vasilis...@gmail.com> wrote:
> I created a folder which, after configuration, contains openembedded,
> bitbake, pixhawk and build subfolders. Then I tried to bitbake x-load
> but keeps sending a parsing error message. As for the demo beagleboard
> repository I linked, there is a uImage of 3.0.17 kernel but when I
> download the rootfs, under /boot directory there is a 2.6.32 uImage.
> This is what confuses me...Thanks for your patience!

Sorry, it is kind of hard to know best how to advise you. I mean, you
could just checkout the latest kernel from git and then just build the
kernel with an external toolchain like CodeSourcery, but then you
would have to know how to config the kernel, take the kernel modules
and put them in the proper place in your rootfs and have knowledge of
building Linux system from scratch. I'm guessing you don't know all
that so even though it looks probably crazy to you .... I kind of
thought maybe following the Angstrom Getting Started instructions
(http://www.angstrom-distribution.org/building-angstrom) would be best
for you. Since it is a well traveled path, you do what is on Koen's
page and you magically get the result you want (almost).

Once you clone the scripts from git and run the setup script, it goes
and gets everything for you.

This is pretty much what you need to do (on the angstrom link above):
MACHINE=beagleboard ./oebb.sh config beagleboard
MACHINE=beagleboard ./oebb.sh update
MACHINE=beagleboard ./oebb.sh bitbake virtual/kernel

Instead of bitbake virtual/kernel, I suggested console-image (you can
do both but console-image is smaller and faster to build)

This takes hours (maybe 6+) depending on how fast your machine and
Internet connection is because it goes off and pulls down the
toolchain and the source for u-boot, kernel, packages in the rootfs
etc. and builds the world for you.

When it completes .... if all goes well ... look for the dir
build/tmp-angstrom_2010_x-eglibc/deploy/images/beagleboard (this is
the location of my last build I did with Angstrom and should look
similar for you) and that directory will contain all you need to put
on the SDCard ... MLO, u-boot, uImage (all goes in FAT, copy MLO first
after you setup the FAT partition) then untar the rootfs into your
ext3/4 partition on the SDCard. You may have to learn how to write a
boot.scr file but all of this is covered on the elinux site and
elsewhere. But the end state of this procedure is a set of components
that is all known to work together. Once you get that far, you can
edit your kernel to setup the SPI driver (probably McSPI3 as it is on
the expansion connector) and then rebuild the kernel.

About the only way to avoid doing all the above is to find a kernel
uImage that is already configured say for McSPI3 on the expansion
connector and hope that the speed, SPI mode etc. will work with
whatever you are trying to hook to it.

Follow the Angstrom getting started then report back when you get a
console-image etc. built ... then you are almost there. Stay on the
path (the steps on the getting started page), don't go into the weeds
trying to understand all this at the moment because your head will
explode ... it will take you a while to fully absorb what all is going
on behind the scenes of this process.

Regards,

Brian

bhensley

unread,
Feb 3, 2012, 11:47:22 AM2/3/12
to Beagle Board
Hello Brian,

I'm trying to do something very similar on my beagleboard XM. The only
difference is i'm really wanting to use Ubuntu 11.10 on my BBXm, and
not Angstrom, as there are some tools I need in Ubuntu. Does anyone
know of where I can find a build of Ubuntu that can be modified for
SPI? I've spent weeks going over elinux and some forums and blogs. I
came to the conclusion that I would have to compile my own kernel and
such but all the pin mux settings i've seen are for older kernel
versions. Most of these come in the form of a patch that I don't
understand how to apply. Any advice for a novice that wants to learn
more about embedded linux on how to apply a patch on a newer kernel
for Ubuntu to enable SPI?

Cheers,
Brian

On Feb 3, 6:41 am, Brian Hutchinson <b.hutch...@gmail.com> wrote:

Brian Hutchinson

unread,
Feb 3, 2012, 1:37:06 PM2/3/12
to beagl...@googlegroups.com
On Fri, Feb 3, 2012 at 11:47 AM, bhensley <bjhens...@gmail.com> wrote:
> Hello Brian,
>
>... Does anyone

> know of where I can find a build of Ubuntu that can be modified for
> SPI? I've spent weeks going over elinux and some forums and blogs. I
> came to the conclusion that I would have to compile my own kernel and
> such but all the pin mux settings i've seen are for older kernel
> versions

I'm a big Debian (Ubuntu) fan but I've never tried running it on a ARM
so I just don't have experience there.

What kind of things do you need that Ubuntu has but you think Angstrom
doesn't have? I find the structure of Angstrom/Arago/Yocto very
Debian like and OE core has just about every package I've ever needed.
I would think that since you are wanting to run on a TI processor,
you would want to be using a distro that directly uses those layers
instead of trying to figure out how to back port TI ARM kernel
features to some Ubuntu kernel. I may be totally out of line with
that comment as I admit I don't have experience running the
Debian/Ubuntu ARM ports on TI processors. I'm not sure Ubuntu cares
what it's kernel is ... you very well could take an Angstrom built
BeagleBoard kernel and use with Ubuntu.

If you are wanting to learn embedded Linux using a BeagleBoard, then
you should start with Angstrom or Yocto as both will easily build
running systems once you know a few command. Once you do that, there
is enough meat there to figure out how all this works to keep you busy
for quite a while and give you quite the education. Once you learn
what all the parts are and how to build them individually etc., then I
would think you could pretty much do whatever you want with regard to
mixing various components from other projects.

Regards,

Brian

John (USP)

unread,
Feb 3, 2012, 7:10:08 PM2/3/12
to beagl...@googlegroups.com

> -----Original Message-----
> From: beagl...@googlegroups.com [mailto:beagl...@googlegroups.com]
> On Behalf Of Vasilis
> Sent: Thursday, February 02, 2012 4:15 PM
> To: Beagle Board
> Subject: [beagleboard] Re: Beagleboard xM - SPI
>
> I created a folder which, after configuration, contains openembedded,
> bitbake, pixhawk and build subfolders. Then I tried to bitbake x-load
> but keeps sending a parsing error message. As for the demo beagleboard
> repository I linked, there is a uImage of 3.0.17 kernel but when I
> download the rootfs, under /boot directory there is a 2.6.32 uImage.
> This is what confuses me...Thanks for your patience!

MLO or x-loader is built as part for u-boot so you no longer have to build
it separately. When you build console-image, u-boot and uImage are built for
you and this is why you see uImage in the /boot folder. You will save
yourself a lot of time learning to use Angstrom. Follow Brian's response to
this post as he did a nice job of explaining how to use Angstrom.

Kind Regards,
John


>
> On Feb 3, 2:05 am, Brian Hutchinson <b.hutch...@gmail.com> wrote:
> > On Thu, Feb 2, 2012 at 6:55 PM, Vasilis <vasilis.vasi...@gmail.com>
wrote:
> > > Hello again! I didn't make it out with OpenEmbedded as I get parsing
> > > errors when I am trying to build the MLO file...Seriously is this the
> > > only way I can get SPI working? I saw that in Beagleboard demo files
> > > (http://www.angstrom-distribution.org/demo/beagleboard) there is a new
> > > kernel (3.0.17)... Can I take advantage of that and build somehow a
> > > new kernel?
> >
> > If it includes the source for the kernel and a cross toolchain to
> > rebuild it ... then yes.  If it is just a kernel image, then no ...
> > unless someone registered a SPI platform driver in the image.  If you
> > do a ls of /dev/ and see a device called spidevX.X then the kernel has
> > a SPI driver configured (now you have to figure out which pins it is
> > using).  If you don't see that then you have to modify the kernel code
> > to register the SPI driver (the elinux SPI example) so the device
> > shows up in /dev for your userspace app to use.
> >
> > So with OE, you got to the point where you had all the repos cloned
> > and an environment setup and were able to do something like bitbake
> > console-image and MLO failed to build?
> >
> > Regards,
> >
> > Brian
>

> --
> To join: http://beagleboard.org/discuss
> To unsubscribe from this group, send email to:
> beagleboard...@googlegroups.com
> Frequently asked questions: http://beagleboard.org/faq

bhensley

unread,
Feb 5, 2012, 2:39:23 AM2/5/12
to beagl...@googlegroups.com
Hey Thanks for the feedback. I actually have been working on getting Ubuntu working for the BB XM with SPI, and today I got it all working. Had a little help from Robert and i've documented my findings on my blog. If anyone is looking for a full walk though for novice users using Ubuntu I hope this helps. My problem was I hated searching too many sites for all the answers over the last couple weeks. Sure feels good to have this all working now.

http://www.brianhensley.net/2012/02/spi-working-on-beagleboard-xm-rev-c.html


Cheers,
Brian

ra...@speakeasy.net

unread,
Feb 5, 2012, 10:50:52 AM2/5/12
to beagl...@googlegroups.com

On Sun Feb 5 2:39 , bhensley <bjhens...@gmail.com> sent:


Very nice writeup, Brian.

Dumb question, maybe: how much of this
might apply to the standard Beagleboard?


/Rafe

bhensley

unread,
Feb 5, 2012, 1:09:45 PM2/5/12
to beagl...@googlegroups.com
Hello Rafe,

I don't know exactly how much might apply to the Beagleboard, but I'm assuming most of the concepts can be applied as well as compiling the kernel and patch. I think the biggest thing to understand the process of what needs to happen. Let me know if you try it and it works.

Cheers,

Brian Hensley
www.brianhensley.net

Tomas Selldén

unread,
Feb 9, 2012, 5:17:40 AM2/9/12
to Beagle Board
Hi,

I'm currently working on getting my SPI running and found this thopic
very interesting. I tried building it like Vasilis and ran into the
same problem, so now i have followed Brians instructions on using the
http://www.angstrom-distribution.org/building-angstrom. What i have
done is to download the files and then i ran:

MACHINE=beagleboard ./oebb.sh config beagleboard
MACHINE=beagleboard ./oebb.sh update
MACHINE=beagleboard ./oebb.sh bitbake console-image

This took a couple of hours as expected, and i got everything
generated as intended(i think). I could locate uboot, uImage etc in
the deploy folder.But now i'm at the stage where i want to update the
arch/arm/mach-omap2/board-omap3beagle.c to expose McSPI3 & 4 to the
userspace( http://elinux.org/BeagleBoard/SPI ).
The problem i have is that i'm not certain how to do this. Shall i go
into the "build/tmp-angstrom_2010_x-eglibc/sysroots/beagleboard/kernel/
arch/arm/mach-omap2/board-omap3beagle.c", then apply the changes and
then run the three ./oebb.sh commands again?

To add to my confusion i found this website:
http://www.slimlogic.co.uk/2011/05/openembeddedangstrom-kernel-workflow/
Having read it, i wonder, is this the suitable work order when using
the scripts and files downloaded from building-angstrom site? If thats
the case i'm abit confused about the bitbake, because i tried to run
the first commands listed and it said i had to install bitbake(but i
can clearly see bitbake in the sources/ directory i got when
downloading the angstrom build).

Best regards, a linux begginer
Tomas

Brian Hutchinson

unread,
Feb 9, 2012, 9:26:22 AM2/9/12
to beagl...@googlegroups.com
On Thu, Feb 9, 2012 at 5:17 AM, Tomas Selldén <tomas....@gmail.com> wrote:
> ... But now i'm at the stage where i want to update the

> arch/arm/mach-omap2/board-omap3beagle.c to expose McSPI3 & 4 to the
> userspace( http://elinux.org/BeagleBoard/SPI ).
> The problem i have is that i'm not certain how to do this. Shall i go

OK good! You are almost there. Now it is time to get your hands dirty.

I'm going to use my last build as an example which should be similar
to what you should see but your mileage may vary :)

The quick and dirty way to make your changes (this is "a way" not "the
way" - as there are many):

The kernel comes from git and gets patches applied to it for your
target (machine) during the bitbake process and the product of that
processes ended up in a work directory. My board-omap3beagle.c file
is in:

build/tmp-angstrom_2010_x-eglibc/work/beagleboard-angstrom-linux-gnueabi/linux-3.0.17-r115c/git/arch/arm/mach-omap2
directory.

Refer to the elinux spi page in earlier messages of this thread but
basically ....
Make your SPI changes to this file (board-omap3beagle.c ). To use my
project as an example I added the following changes/sections:

#include <linux/spi/spi.h>

// For McSPI3 on expansion connector
static struct spi_board_info beagle_mcspi_board_info[] = {
{
.modalias = "spidev",
.max_speed_hz = 100000, //100 KHz
.bus_num = 3,
.chip_select = 0,
.mode = SPI_CS_HIGH | SPI_MODE_1,
}
};

In omap3_beagle_init I added:

//BTH - For McSPI3
spi_register_board_info(beagle_mcspi_board_info,
ARRAY_SIZE(beagle_mcspi_board_info));

Now for the fun part. After you make these changes, if you run the
bitbake virtual/whatever you will most likely wipe out your changes
(at least that was my experience when I was learning). Oh, you will
get a kernel image but it will take kernel from git and apply the
patches and the result will over write the files you just changed.

You want to just recompile the kernel (everything else has already
been done for you if you did say a console-image etc.) so you need to
do that with a command like:

bitbake -f -c compile linux-3.0.17

When this is done ... your uImage will be somewhere like:
build/tmp-angstrom_2010_x-eglibc/work/beagleboard-angstrom-linux-gnueabi/linux-3.0.17-r115c/git/arch/arm/boot

... but will not be in the image directory.

Run the deploy command on the kernel:
bitbake -f -c deploy linux-3.0.17

... and you should have ready-to-go images in a directory that looks
something like:
build/tmp-angstrom_2010_x-eglibc/deploy/images/beagleboard

Put these in the proper place on the SD Card and enjoy. Go get
yourself a cold beverage ... you earned it. Enjoy watching the board
boot the kernel you just modified. You'll have to rename the files on
the SD Card to be MLO, u-boot.bin, uImage etc. There is the small
detail of a boot.scr or uEnv.txt script that you'll need but you can
google for how to construct one of those too.

look in /dev/ to see if you have a /dev/spidev3.0 device (the result
of my example above). If it is there, then you should be good to go.
Write a user space program to use it. Checkout and google spidev_test
as an example.

Regards,

Brian

Message has been deleted

Brian Hutchinson

unread,
Feb 9, 2012, 9:54:16 AM2/9/12
to beagl...@googlegroups.com
On Thu, Feb 9, 2012 at 9:00 AM, Tomas Selldén <tomas....@gmail.com> wrote:
> It would appear as if i only can find .h files in the sysroot/
> beagleboard/kernel/arch/arm/mach-omap2/ directory. No board-
> omap3beagle.c or any other .c file there. So i'm afraid i'm really
> stuck on how to get on from now on.

If you don't have normal kernel files in a directory similar to:

build/tmp-angstrom_2010_x-eglibc/work/beagleboard-angstrom-linux-gnueabi/linux-3.0.17-r115c/git

... then it could be that the bitbake command you ran to build the
system (console-image etc.) is cleaning up after itself and you may
have to run bitbake -f -c linux-3.0.17 (or whatever it is now ... this
was the last git pull I did) so that the kernel is built and the final
source is left in place.

You might have to run some find commands to make sure you aren't
getting lost in the directory jungle.

cd into build/ and run find . -name "board-omap3beagle.c" ... it
should be in a directory similar to what I described.

Regards,

Brian

Brian Hutchinson

unread,
Feb 9, 2012, 9:58:29 AM2/9/12
to beagl...@googlegroups.com
Here is a page that might help you pick up what I'm laying down:

http://wh1t3s.com/2009/05/11/oe-bitake-kernel-mods/

John (USP)

unread,
Feb 9, 2012, 7:18:59 PM2/9/12
to beagl...@googlegroups.com

> -----Original Message-----
> From: beagl...@googlegroups.com [mailto:beagl...@googlegroups.com]
> On Behalf Of Tomas Selldén
> Sent: Thursday, February 09, 2012 6:00 AM
> To: Beagle Board
> Subject: [beagleboard] Re: Beagleboard xM - SPI
>

> It would appear as if i only can find .h files in the sysroot/
> beagleboard/kernel/arch/arm/mach-omap2/ directory. No board- omap3beagle.c
or
> any other .c file there. So i'm afraid i'm really stuck on how to get on
from now on.

In your local.conf file, there is a line that removes the source code after
a successful build. You need to comment out the line:

INHERIT += "rm_work"

Regards,
John


>
> On Feb 9, 11:17 am, Tomas Selldén <tomas.sell...@gmail.com> wrote:
> > Hi,
> >
> > I'm currently working on getting my SPI running and found this thopic
> > very interesting. I tried building it like Vasilis and ran into the
> > same problem, so now i have followed Brians instructions on using

> > thehttp://www.angstrom-distribution.org/building-angstrom. What i have


done is
> to download the files and then i ran:
> >
> > MACHINE=beagleboard ./oebb.sh config beagleboard MACHINE=beagleboard
> > ./oebb.sh update MACHINE=beagleboard ./oebb.sh bitbake console-image
> >
> > This took a couple of hours as expected, and i got everything
> > generated as intended(i think). I could locate uboot, uImage etc in
> > the deploy folder.But now i'm at the stage where i want to update the
> > arch/arm/mach-omap2/board-omap3beagle.c to expose McSPI3 & 4 to the
> > userspace(http://elinux.org/BeagleBoard/SPI).
> > The problem i have is that i'm not certain how to do this. Shall i go
> > into the
> > "build/tmp-angstrom_2010_x-eglibc/sysroots/beagleboard/kernel/
> > arch/arm/mach-omap2/board-omap3beagle.c", then apply the changes and
> > then run the three ./oebb.sh commands again?
> >
> > To add to my confusion i found this
> > website:http://www.slimlogic.co.uk/2011/05/openembeddedangstrom-kernel
> > -workflow/ Having read it, i wonder, is this the suitable work order
> > when using the scripts and files downloaded from building-angstrom
> > site? If thats the case i'm abit confused about the bitbake, because i
> > tried to run the first commands listed and it said i had to install
> > bitbake(but i can clearly see bitbake in the sources/ directory i got
> > when downloading the angstrom build).
> >
> > Best regards, a linux begginer
> > Tomas
>

Tomas S

unread,
Feb 10, 2012, 10:06:28 AM2/10/12
to Beagle Board
Hi again!

I have managed to get the git directory, build/tmp-angstrom_2010_x-
eglibc/work/beagleboard-angstrom-linux-gnueabi/linux-3.0.17-r115c/git.
I have been able to edit the board-omap3beagle.c. I have a uImage in
the directory:
build/tmp-angstrom_2010_x-eglibc/work/beagleboard-angstrom-linux-
gnueabi/linux-3.0.17-r115c/git/arch/arm/boot

The problem i have right now is deploying it. I run the deploy but the
files in the directory: build/tmp-angstrom_2010_x-eglibc/deploy/images/
beagleboard are not utdated.

I'm not sure if i might be the one causing the problem or not, when i
looked at the build-angstroms site where you use the "MACHINE=beagle ./
oebb bitbake console-image" i figured that the part "./oebb bitbake"
was a possible way to start the bitbake. So to launch my compile &
deploy i've used "./oebb bitbake -f -c compile linux-3.0.17" and "./
oebb bitbake -f -c deploy linux-3.0.17".

I did some experimenting, i made a change to board-omap3beagle.c, then
i ran compile and on of the notes that was posted was:
NOTE: Tasks Summary: Attempted 304 tasks of which 303 didn't need to
be rerun and all succeeded."
After the compile i could see(by looking at time modified of the file)
that board-omap3beagle.o and uImage was updated.
When i do run the deploy, one of the note says: " NOTE: Tasks Summary:
Attempted 390 tasks of which 390 didn't need to be rerun and all
succeeded."
And i suppose that tells us that it doesnt do or change anything.

Are any of you familiar with this problem?

I greatly appreciate the help you've given me and any tips on solving
this last problem would be great.
Regards,
Tomas

Brian Hutchinson

unread,
Feb 17, 2012, 9:22:18 PM2/17/12
to beagl...@googlegroups.com
On 2/10/12, Tomas S <tomas....@gmail.com> wrote:
> ... I have a uImage in
> the directory:
> build/tmp-angstrom_2010_x-eglibc/work/beagleboard-angstrom-linux-
> gnueabi/linux-3.0.17-r115c/git/arch/arm/boot

If you have an uImage there then you can use that. It is the same one
that gets copied over into the images directory during the deploy
phase.


>
> The problem i have right now is deploying it. I run the deploy but the
> files in the directory: build/tmp-angstrom_2010_x-eglibc/deploy/images/
> beagleboard are not utdated.
>

Not sure why this is. Sorry.

> I'm not sure if i might be the one causing the problem or not, when i
> looked at the build-angstroms site where you use the "MACHINE=beagle ./

Hopefully you are setting it to MACHINE=beagleboard :)

Regards,

Brian

Tomas S

unread,
Feb 20, 2012, 2:25:29 AM2/20/12
to Beagle Board
Hi Brian,

I managed to get it working. I simply started over from the begining
again. I think what confused me a bit was keeping track on all the
different console-image/deploy/compile commands. I've been able to run
the spidev_test and i've also checked the signals with an ociloscope,
all works great =)

So thanks alot for the help!

Regards,
Tomas

Brian Hutchinson

unread,
Feb 20, 2012, 10:16:02 AM2/20/12
to beagl...@googlegroups.com
On Mon, Feb 20, 2012 at 2:25 AM, Tomas S <tomas....@gmail.com> wrote:

> I managed to get it working.

Outstanding! Now you'll have to figure out how to do the same thing
with Device Trees so you don't have to modify the board file!
Unfortunately, folks like me that are stuck on older ARM kernels
(2.6.37) still have to modify the board file to configure platform
devices.

Regards,

Brian

Vasilis

unread,
Mar 2, 2012, 4:46:04 PM3/2/12
to Beagle Board
Hello! I finally managed to setup SPI drivers for Beagleboard xM
running Ubuntu and ran the spitest program following these
instructions:

http://www.brianhensley.net/2012/02/spi-working-on-beagleboard-xm-rev-c.html
(special thanks to Robert Berger who help me out a lot with some
fundamental stuff)

I have the Trainer xM board now and I want to see if SPI is actually
working. So I hooked up MOSI and MISO on the Trainer and ran the
spitest program. I was surprised to see that nothing happenned. I want
to state that SPI on Beagleboard itself worked fine.

Jacek Radzikowski

unread,
Mar 2, 2012, 5:04:00 PM3/2/12
to beagl...@googlegroups.com
Which SPI did you use? For SPI3 you may have to set direction of the
buffers on the TrainerBoard.

j.

> --
> To join: http://beagleboard.org/discuss
> To unsubscribe from this group, send email to:
> beagleboard...@googlegroups.com
> Frequently asked questions: http://beagleboard.org/faq

--
Given a choice between two theories, take the one which is funnier

Vasilis

unread,
Mar 2, 2012, 5:10:42 PM3/2/12
to Beagle Board
I didn't know that. I have no preference on which SPI to use. Do you
think that if I use SPI4 there will be no such problem? How do you
change the buffer direction on Trainer? Thank you for your response!

On 3 Μαρ, 00:04, Jacek Radzikowski <jacek.radzikow...@gmail.com>
wrote:
> Which SPI did you use? For SPI3 you may have to set direction of the
> buffers on the TrainerBoard.
>
> j.
>
>
>
>
>
>
>
>
>
> On Fri, Mar 2, 2012 at 16:46, Vasilis <vasilis.vasi...@gmail.com> wrote:
> > Hello! I finally managed to setup SPI drivers for Beagleboard xM
> > running Ubuntu and ran the spitest program following these
> > instructions:
>
> >http://www.brianhensley.net/2012/02/spi-working-on-beagleboard-xm-rev...

Jacek Radzikowski

unread,
Mar 2, 2012, 5:19:23 PM3/2/12
to beagl...@googlegroups.com
Buffers for SPI4 have fixed directions. Directions of buffers for SPI3
is controlled by pins on the BB's expansion connector, so it can be
used as either master or slave. If you followed Brian's tutorial, most
likely you ended up using SPI3. Take a look at the schematic of
Trainer and configure directions of SPI lines going through U1 and U2.

j.

Vasilis

unread,
Mar 2, 2012, 5:48:25 PM3/2/12
to Beagle Board
I see. So TPI11 - TPI14 refers to SPI4? That was something useful
indeed! Isn't it possible to run this spitest through SPI4? Basically,
I am not aware of the spitest source code, so I feel a bit blind!

On 3 Μαρ, 00:19, Jacek Radzikowski <jacek.radzikow...@gmail.com>
wrote:
> Buffers for SPI4 have fixed directions. Directions of buffers for SPI3
> is controlled by pins on the BB's expansion connector, so it can be
> used as either master or slave. If you followed Brian's tutorial, most
> likely you ended up using SPI3. Take a look at the schematic of
> Trainer and configure directions of SPI lines going through U1 and U2.
>
> j.
>
>
>
>
>
>
>
>
>
> On Fri, Mar 2, 2012 at 17:10, Vasilis <vasilis.vasi...@gmail.com> wrote:
> > I didn't know that. I have no preference on which SPI to use. Do you
> > think that if I use SPI4 there will be no such problem? How do you
> > change the buffer direction on Trainer? Thank you for your response!
>
> > On 3 Ìáñ, 00:04, Jacek Radzikowski <jacek.radzikow...@gmail.com>

Jacek Radzikowski

unread,
Mar 2, 2012, 7:02:18 PM3/2/12
to beagl...@googlegroups.com
On Fri, Mar 2, 2012 at 17:48, Vasilis <vasilis...@gmail.com> wrote:
> I see. So TPI11 - TPI14 refers to SPI4? That was something useful

Apparently.

> indeed! Isn't it possible to run this spitest through SPI4? Basically,
> I am not aware of the spitest source code, so I feel a bit blind!

You probably know about spitest more than I do, but I'd start from
shorting MISO and MOSI pins on SPI4 and modifying path passed through
'-D' option.

j.

Vasilis

unread,
Mar 2, 2012, 7:29:57 PM3/2/12
to Beagle Board
> You probably know about spitest more than I do, but I'd start from
> shorting MISO and MOSI pins on SPI4 and modifying path passed through
> '-D' option.

Yes it will be my next step. I will let you know if I come up with
anything. Thank you for your support!

Vasilis

unread,
Mar 3, 2012, 9:48:19 AM3/3/12
to Beagle Board
It seems that I only have spidev3.0 and spidev3.1 under my /dev
directory on BeagleBoard. I examined the RevB schematic of the Trainer
Board and I saw that SPI3_SOMI and SPI3_SIMO refer to TP21 and TP15
respectively. So I hooked up these pins and still nothing happened. Is
there something I am doing wrong about that? Here are the schematics:
http://www.tincantools.com/assets/trainer_rev-b.pdf
Thank you in advance!

Jacek Radzikowski

unread,
Mar 3, 2012, 9:51:56 AM3/3/12
to beagl...@googlegroups.com
Did you configure buffers?

j.

Vasilis

unread,
Mar 3, 2012, 9:55:44 AM3/3/12
to Beagle Board
> Did you configure buffers?
Thanks for the reply. No I don't know how to do that. Is there any
guide on this or something else?

Jacek Radzikowski

unread,
Mar 3, 2012, 10:04:15 AM3/3/12
to beagl...@googlegroups.com
Direction of buffers is determined by levels on corresponding DIR
pins. Read the buffer IC types from the schematic, find and read their
datasheets, check which GPIOs are connected to DIR pins, configure
them as outputs and set correct logic levels.

j.

Vasilis

unread,
Mar 3, 2012, 11:19:51 AM3/3/12
to Beagle Board
I can now understand the whole concept. The last thing I think I need
to know is how to set High or Low the DIR pins. Can this be made
through BeagleBoard with a single command and if it is so, how is this
possible? Thanks!

Jacek Radzikowski

unread,
Mar 3, 2012, 11:37:57 AM3/3/12
to beagl...@googlegroups.com
No, this is one of the most important things to know to get the SPI
working through the TrainerBoard. How to manipulate the GPIOs has been
discussed many times on the list.

j.

Vasilis

unread,
Mar 3, 2012, 7:07:56 PM3/3/12
to Beagle Board
For this simple test I need to do, I can see from the schematics that
GPIO_137 controls the SOMI and GPIO_131 controls the SIMO. Is it
enough to set GPIO_131 "high" for MASTER OUT by giving the shell
commands:

echo 131 > /sys/class/gpio/export
echo "high" > /sys/class/gpio131/direction

and GPIO_137 "low" respectively? Thank you!

On 3 Μαρ, 18:37, Jacek Radzikowski <jacek.radzikow...@gmail.com>
wrote:
> No, this is one of the most important things to know to get the SPI
> working through the TrainerBoard. How to manipulate the GPIOs has been
> discussed many times on the list.
>
> j.
>

Jacek Radzikowski

unread,
Mar 4, 2012, 12:29:36 AM3/4/12
to beagl...@googlegroups.com
Not 131. Also, read again how to control GPIOs.

j.


2012/3/3 Vasilis <vasilis...@gmail.com>:

Vasilis

unread,
Mar 4, 2012, 9:01:02 AM3/4/12
to Beagle Board
> Not 131.

Why not 131? The default direction is from B to A (from Trainer intro
Beagle and not vice versa) considering DIR pins low, so if I make this
pin High the direction shall change right? Is it something wrong with
that?

> Not 131. Also, read again how to control GPIOs.

I searched the list and I found out that this is one of the ways to
access GPIOs through shell commands. Where exactly is the error in
this command? Thank you in advance!

Jacek Radzikowski

unread,
Mar 4, 2012, 10:46:00 PM3/4/12
to beagl...@googlegroups.com
On Sun, Mar 4, 2012 at 09:01, Vasilis <vasilis...@gmail.com> wrote:
>> Not 131.
>
> Why not 131? The default direction is from B to A (from Trainer intro
> Beagle and not vice versa) considering DIR pins low, so if I make this
> pin High the direction shall change right? Is it something wrong with
> that?

GPIO131 does not control direction of any of the buffers.


>> Not 131. Also, read again how to control GPIOs.
> I searched the list and I found out that this is one of the ways to
> access GPIOs through shell commands. Where exactly is the error in
> this command? Thank you in advance!

The page with instructions how to control GPIOs on beagleboard is
linked from TrainerBoard's page on elinux.org.
If you want to receive a helpful advice from the group, you should
really put more effort into doing your homework.


j.

Vasilis

unread,
Mar 6, 2012, 10:11:02 AM3/6/12
to Beagle Board
OK I figured it out! Sorry it was not 131, after a more clear look I
saw it was 137, however I changed the GPIO level with the manner I
explained and everything worked just fine for me.
Reply all
Reply to author
Forward
0 new messages