-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUse SPI with Flashrom
More file actions
62 lines (31 loc) · 1.47 KB
/
Use SPI with Flashrom
File metadata and controls
62 lines (31 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
First we will look at SPI0
Connect to your PI and then :
sudo apt update
sudo apt install flashrom
sudo raspi-config ( from interfaces enable SPI && save and exit)
Then enable SPI in the kernel:
modprobe spidev
modprobe spi_bcm2835
Now you can connect the carrier board with the flash memory on it to the RPI HAT SPI0 Port and check if the Memory is recognized :
flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512
To dump a memory you can run the following command :
flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 -c CHIPNAME_AS_IDENTIFIED_IN_THE_PREVIOUS_COMMAND -r DESIRED_FILE_NAME.EXTENSION
To write a dump to another memory IC
flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 -c CHIPNAME_AS_IDENTIFIED_IN_THE_PREVIOUS_COMMAND -w DESIRED_FILE_NAME.EXTENSION
If you have to add a few blocks to make the size match use :
truncate -s +NUMBER_OF_BLOCKS DESIRED_FILE_NAME.EXTENSION
Be careful and please bear in mind I can not be blamed for any mistake you make or any device that you damage or any other thing that doesn't work in your setup or around it !
Now to use the SPI1 we have to :
Connect to your PI and then :
sudo apt update
sudo apt install flashrom
sudo raspi-config ( from interfaces enable SPI && save and exit)
Then enable SPI in the kernel:
modprobe spidev
modprobe spi_bcm2835
sudo nano /boot/config.txt
Add at the bottom
dtoverlay=spi1-3cs #3 chip select
REBOOT
In flashrom
flashrom -p linux_spi:dev=/dev/spidev1.2,spispeed=500