Difference between revisions of "RaspberryPi"

From flashrom
Jump to: navigation, search
Line 1: Line 1:
 
__FORCETOC__
 
__FORCETOC__
[http://www.raspberrypi.org/faqs RaspberryPi] is a cheap single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of
+
[http://www.raspberrypi.org/faqs RaspberryPi] is a cheap single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools.  
stimulating the teaching of basic computer science in schools. It can run a fully-functional GNU/Linux distribution and exposes SPI, I2C and several GPIOs on its expansion header.
+
It can run a fully-functional GNU/Linux distribution and exposes SPI, I2C and several GPIOs on its expansion header.
  
 
= Prerequisites =
 
= Prerequisites =
 
Use latest Raspbian (or any other distribution with a recent kernel).
 
Use latest Raspbian (or any other distribution with a recent kernel).
Run the following commands:
+
Run the following commands (or make sure these kernel modules are loaded successfully):
  
 
  modprobe spi_bcm2708
 
  modprobe spi_bcm2708
Line 45: Line 45:
 
In general all other pins (usually pin 3 is /WP and pin 7 is /HOLD) should be connected to Vcc unless they are required to be floating or connected to GND (both extremely uncommon for SPI flash chips). Please consult the datasheet for the flash chip in question.
 
In general all other pins (usually pin 3 is /WP and pin 7 is /HOLD) should be connected to Vcc unless they are required to be floating or connected to GND (both extremely uncommon for SPI flash chips). Please consult the datasheet for the flash chip in question.
  
= Example output =
+
= Running flashrom =
<pre>
+
Flashrom uses the Linux-native SPI driver, which is implemented by flashrom's linux_spi module.
paul@raspberrypi:~/flashrom$ time ./flashrom -r wr741nd-flash.bin -V -p linux_spi:dev=/dev/spidev0.0
+
To use the RaspberryPi with flashrom you have to specify that module followed by the Linux SPI device, e.g.
flashrom v0.9.5.2-r1547 on Linux 3.2.21-rpi1+ (armv6l)
+
./flashrom -p linux_spi:dev=/dev/spidev0.0
flashrom is free software, get the source code at http://www.flashrom.org
 
 
 
flashrom was built with GCC 4.6.3, little endian
 
Command line (5 args): ./flashrom -r wr741nd-flash.bin -V -p linux_spi:dev=/dev/spidev0.0
 
Calibrating delay loop... OS timer resolution is 5 usecs, 210M loops per second, 10 myus = 11 us, 100 myus = 109 us, 1000 myus = 1237 us, 10000 myus = 10299 us, 20 myus = 37 us, OK.
 
Initializing linux_spi programmer
 
Using device /dev/spidev0.0
 
The following protocols are supported: SPI.
 
...
 
Chip status register is 00
 
Found Winbond flash chip "W25Q32" (4096 kB, SPI) on linux_spi.
 
...
 
Found Winbond flash chip "W25Q32" (4096 kB, SPI).
 
This chip may contain one-time programmable memory. flashrom cannot read
 
and may never be able to write it, hence it may not be able to completely
 
clone the contents of this chip (see man page for details).
 
Reading flash... done.
 
 
 
0.85user 0.66system 1:28.12elapsed 1%CPU (0avgtext+0avgdata 18976maxresident)k
 
0inputs+8192outputs (0major+1232minor)pagefaults 0swaps
 
</pre>
 

Revision as of 21:36, 19 October 2014

RaspberryPi is a cheap single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools. It can run a fully-functional GNU/Linux distribution and exposes SPI, I2C and several GPIOs on its expansion header.

Prerequisites

Use latest Raspbian (or any other distribution with a recent kernel). Run the following commands (or make sure these kernel modules are loaded successfully):

modprobe spi_bcm2708
modprobe spidev

Connecting the flash chip

To learn more about the RPi's expansion header refer to http://elinux.org/Rpi_Low-level_peripherals . Please do not try to draw more than 50mA from the 3.3V pin. If the flash chip is still placed in a foreign circuit (e.g. soldered to a PC mainboard) please refer to ISP for further details.

RPi header SPI flash
17 Vcc 3.3V
25 GND
19 DI
21 DO
23 SCK
24 /CS

In general all other pins (usually pin 3 is /WP and pin 7 is /HOLD) should be connected to Vcc unless they are required to be floating or connected to GND (both extremely uncommon for SPI flash chips). Please consult the datasheet for the flash chip in question.

Running flashrom

Flashrom uses the Linux-native SPI driver, which is implemented by flashrom's linux_spi module. To use the RaspberryPi with flashrom you have to specify that module followed by the Linux SPI device, e.g.

./flashrom -p linux_spi:dev=/dev/spidev0.0