You are on page 1of 4

Raspberry PI 25LC010A EEPROM Howto | Jotschi's Blog

http://www.jotschi.de/?p=784

Jotschi's Blog
NeXuS

Raspberry PI 25LC010A EEPROM Howto


Posted on 6 September, 2012 by Jotschi This article will explain how to get a SPI connection working using the Raspberry PI GPIO pins. Hardware: I used the Adafruit pi cobbler to connect the GPIO header with my breadboard. The 25LC010a eeprom chip is a small eeprom chip. The datasheet can be found here. Software: I used the default raspbian image for the raspberry pi. The wiringpi toolchain contains some neat little programs and libraries to get I2C and SPI working with the raspberry pi. 1. Disable the blacklist by adding a # in front of each line because you will need the SPI kernel module:

View Raw Code

1. /etc/modprobe.d/raspi-blacklist.conf 2. Reboot the PI 3. Install wiringPI as described here.

View Raw Code

1. 2. 3. 4.

sudo apt-get install git-core git clone git://git.drogon.net/wiringPi cd wiringPi ./build

4. Use the build gpio tool to load and setup SPI

View Raw Code

1. gpio load spi 5. Connect the IC as shown in this image:

1 of 4

01/07/2013 08:16 PM

Raspberry PI 25LC010A EEPROM Howto | Jotschi's Blog

http://www.jotschi.de/?p=784

The two resistors are very important because they are used to pullup the SCK and MOSI pin. The eeprom works with 5V or 3.3V. I used 3.3V because the GPIO pins only tolerate 3.3V input. Higher voltage might damage your board.

6. Compile the source file. You can use this make file:

View Raw Code

1. 2. 3. 4. 5.

#DEBUG DEBUG CC INCLUDE CFLAGS

= = = = =

-g -O0 -O3 gcc -I/usr/local/include $(DEBUG) -Wall $(INCLUDE) -Winline -pipe

2 of 4

01/07/2013 08:16 PM

Raspberry PI 25LC010A EEPROM Howto | Jotschi's Blog

http://www.jotschi.de/?p=784

6. 7. LDFLAGS = -L/usr/local/lib 8. LIBS = -lwiringPi 9. 10. # Should not alter anything below this line 11. ########################################################################### #### 12. 13. SRC 14. 15. OBJ 16. 17. all: 18. 19. rpi_spi_eepromtest: 20. 21. 22. 23. .c.o: 24. 25. 26. 27. clean: 28. 29. 30. tags: 31. 32. 33. 34. depend: makedepend -Y $(SRC) 35. 36. 37. # DO NOT DELETE Sources: [gist id=3659646 file=rpi_spi_eepromtest.c] rm -f $(OBJ) *~ core tags rpi_spi_eepromtest $(SRC) @echo [ctags] @ctags $(SRC) rpi_spi_eepromtest.o @echo [link] $(CC) -o $@ rpi_spi_eepromtest.o $(LDFLAGS) $(LIBS) = = rpi_spi_eepromtest.c rpi_spi_eepromtest.o rpi_spi_eepromtest

@echo [CC] $< @$(CC) -c $(CFLAGS) $< -o $@

3 of 4

01/07/2013 08:16 PM

Raspberry PI 25LC010A EEPROM Howto | Jotschi's Blog

http://www.jotschi.de/?p=784

This entry was posted in Technik by Jotschi. Bookmark the permalink [http://www.jotschi.de/?p=784] .
0

Add a comment

4 of 4

01/07/2013 08:16 PM

You might also like