| 1 |
=========== |
| 2 |
RaspberryPi |
| 3 |
=========== |
| 4 |
|
| 5 |
`RaspberryPi <http://www.raspberrypi.org/faqs>`_ is a cheap single-board computer developed in the UK |
| 6 |
by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools. |
| 7 |
It can run a fully-functional GNU/Linux distribution and exposes SPI, I2C and several GPIOs on its expansion header. |
| 8 |
|
| 9 |
Prerequisites |
| 10 |
============= |
| 11 |
|
| 12 |
Use latest Raspbian (or any other distribution with a recent kernel). |
| 13 |
Run the following commands (or make sure these kernel modules are loaded successfully):: |
| 14 |
|
| 15 |
modprobe spi_bcm2835 # If that fails you may wanna try the older spi_bcm2708 module instead |
| 16 |
modprobe spidev |
| 17 |
|
| 18 |
Connecting the flash chip |
| 19 |
========================= |
| 20 |
|
| 21 |
To learn more about the RPi's expansion header refer to http://elinux.org/Rpi_Low-level_peripherals . |
| 22 |
If you use one of the first A or B models, please make sure to not draw more than 50mA from the 3.3V pin. |
| 23 |
Official numbers for newer models are hard to find but they use a switching regulator |
| 24 |
that should provide a much higher margin. If the flash chip is still placed in a foreign circuit |
| 25 |
(e.g. soldered to a PC mainboard) please refer to :doc:`/user_docs/in_system` for further details. |
| 26 |
|
| 27 |
========== ======================= |
| 28 |
RPi header SPI flash |
| 29 |
========== ======================= |
| 30 |
25 GND |
| 31 |
24 /CS |
| 32 |
23 SCK |
| 33 |
21 DO |
| 34 |
19 DI |
| 35 |
17 VCC 3.3V (+ /HOLD, /WP) |
| 36 |
========== ======================= |
| 37 |
|
| 38 |
.. container:: danger, admonition |
| 39 |
|
| 40 |
Always connect all input pins of integrated circuits (not only flash chips). |
| 41 |
|
| 42 |
In general the other pins (usually pin 3 is /WP and pin 7 is /HOLD) should be connected to Vcc |
| 43 |
unless they are required to be floating or connected to GND (both extremely uncommon for SPI flash chips). |
| 44 |
Please consult the datasheet for the flash chip in question. |
| 45 |
|
| 46 |
If your flash chip is detected but your read/write/verify operations tend to fail, try to add decoupling capacitors (one 100nF and one 4.7uF ceramic capacitor is preferred) close to the flash chip's power pin. |
| 47 |
|
| 48 |
Running flashrom |
| 49 |
================ |
| 50 |
|
| 51 |
Flashrom uses the Linux-native SPI driver, which is implemented by flashrom's linux_spi programmer. |
| 52 |
To use the RaspberryPi with flashrom, you have to specify that programmer. You should always tell |
| 53 |
it at what speed the SPI bus should run; you specify that with the spispeed parameter (given in kHz). |
| 54 |
You also have to specify the Linux SPI device, e.g.:: |
| 55 |
|
| 56 |
flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=1000 |