RaspberryPi: Difference between revisions

From flashrom
Jump to navigation Jump to search
(Update on 3.3V current figures)
 
(5 intermediate revisions by 3 users not shown)
Line 7: Line 7:
Run the following commands (or make sure these kernel modules are loaded successfully):
Run the following commands (or make sure these kernel modules are loaded successfully):


  modprobe spi_bcm2708
  modprobe spi_bcm2835 # If that fails you may wanna try the older spi_bcm2708 module instead
  modprobe spidev
  modprobe spidev


= Connecting the flash chip =
= 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.
To learn more about the RPi's expansion header refer to http://elinux.org/Rpi_Low-level_peripherals . 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. Official numbers for newer models are hard to find but they use a switching regulator that should provide a much higher margin. 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.


{| border="0" style="background-color: #eeeeee"
{| border="0" style="background-color: #eeeeee"
Line 37: Line 37:
|}
|}


<div style="margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; background-color:#ee0000; text-align:center; border:1px solid #aabbcc;"><small>
<div style="margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; background-color:#a00000; color:#ffffff; text-align:center; border:1px solid #aabbcc; font-size:20px;">
'''Always''' connect '''all''' input pins of integrated circuits (not only flash chips).
'''Always''' connect '''all''' input pins of integrated circuits (not only flash chips).
</small></div>
</div>




In general the 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 the 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.
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.
See Micron's TN-25-09: Layout Guidelines PCB Design Recommendations/VCC Power Supply Decoupling
[https://www.micron.com/-/media/client/global/documents/products/technical-note/nor-flash/tn2509_layout_guidelines_spi_nor_mt25q.pdf]


= Running flashrom =
= Running flashrom =
Flashrom uses the Linux-native SPI driver, which is implemented by flashrom's linux_spi module.
Flashrom uses the Linux-native SPI driver, which is implemented by flashrom's
To use the RaspberryPi with flashrom you have to specify that module followed by the Linux SPI device, e.g.
''linux_spi'' module. To use the RaspberryPi with flashrom, you have to specify
  flashrom -p linux_spi:dev=/dev/spidev0.0
that driver. You should always tell it at what speed the SPI bus should run;
you specify that with the ''spispeed'' parameter (given in kHz). You also have
to specify the Linux SPI device, e.g.
  flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=1000

Latest revision as of 07:52, 29 April 2021

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_bcm2835 # If that fails you may wanna try the older spi_bcm2708 module instead
modprobe spidev

Connecting the flash chip

To learn more about the RPi's expansion header refer to http://elinux.org/Rpi_Low-level_peripherals . 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. Official numbers for newer models are hard to find but they use a switching regulator that should provide a much higher margin. 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
25 GND
24 /CS
23 SCK
21 DO
19 DI
17 VCC 3.3V (+ /HOLD, /WP)

Always connect all input pins of integrated circuits (not only flash chips).


In general the 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.

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.

See Micron's TN-25-09: Layout Guidelines PCB Design Recommendations/VCC Power Supply Decoupling [1]

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 driver. You should always tell it at what speed the SPI bus should run; you specify that with the spispeed parameter (given in kHz). You also have to specify the Linux SPI device, e.g.

flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=1000