*Preliminary* SPI on the Pi: Communicating with a SPI 3-axis accelerometer using a Raspberry Pi by engineerbynight
Compile and run.jpg
Step by step guide on how to setup Raspbian, and communicate with a SPI device using bcm2835 SPI library (NOT bit banged!)

This is still very preliminary... I need to add better pictures of physical hookup, and work through some of the awkward code.
 
Remove these adsRemove these ads by Signing Up

Step 1: Starting with a blank SD card, download Raspbian image, and install onto SD card

Visit http://www.raspberrypi.org/downloads for instructions on how to install Raspbian

I downloaded:
    Raspbian image, and used
    Win32DiskImager to install on SD card

There's also more information at http://elinux.org/RPi_Easy_SD_Card_Setup
julioterra says: Jan 21, 2013. 12:43 PM
I had to update the following command in order to get this tutorial to work:
(1) updated inputs (denoted by -I in command)
(2) updated the path from ../bcm2835.c to ../bcm2835-1.5/src/bcm2835.c
(3) updated file name from ADXL_RaspPi.c to ADXL362_RaspPi.c

gcc -o ADXL362_RaspPi -I ../bcm2835-1.5/src ../bcm2835.c ADXL_RaspPi.c


eduap says: Oct 8, 2012. 7:09 AM
-Try this to do it from command line:

1) create a specific directory:
mkdir ADXL362_RaspPi
cd ADXL362_RaspPi/

2) install Git if you don't have it:
sudo apt-get install git

3) create a repository and pull from Github:
git init .
git add .
git pull https://github.com/annem/ADXL362_RaspPi.git
owendelong says: Oct 7, 2012. 4:18 AM
You can avoid the email by using IPv6 Link Local.
Your raspberry PI will always have the same IPv6 Link Local address every time it boots and it's determined from it's mac address.

For example, if your PI has a MAC address of 23:45:67:89:ab:cd, then it's link local address will be fe80::2145:67ff:fe89:abcd.

Converting the MAC to link local is as follows: Take the first three octets of MAC and insert FFFE and then the last 3 octets. (all values in hex).
For 11:11:11:22:22:22 this results in 1111:11FF:FE22:2222

Then, invert the 0x02 bit of the first octet: 1311:11ff:fe22:2222.

Finally place fe80:: in front fe80::1311:11ff:fe22:2222

Now, to communicate with that, you will need to specify the interface ID of the outbound interface on your machine. On rational systems, this is the name of the interface, such as "eth0" on Linux or "en0" on Mac, "fxp0" on BSD, etc. On windows boxes, it's unfortunately a number which has little rime or reason to it, but you should be able to get the correct number from ipconfig /all.
engineerbynight (author) says: Oct 8, 2012. 7:08 AM
I'll have to tinker with that... thanks! Not familiar with IPv6, yet. Thanks for the tip!
mydigitalhome says: Jul 27, 2012. 8:47 AM
Awesome instructable. If your RasPi browser nameserver isn't pulling up domains, try:

# sudo cat >> /etc/resolv.conf
nameserver 8.8.8.8
control-z-key

This adds the Google public DNS server. You can add any nameserver you want instead of 8.8.8.8

Others can build on this to do hardware SPI instead of bitbanging, saving digital pins and making things faster, cool :)
engineerbynight (author) says: Jul 27, 2012. 9:03 AM
Thanks so much for the tip! I can use all the advice I can get ;)

I'll give it a try, and update the tutorial if is works.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!