Merge pull request #5 from janmg/main

SPI Additions
pull/6/head
Swissky 2022-10-03 14:08:14 +02:00 committed by GitHub
commit 2d53bd170c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

BIN
docs/assets/Esp32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 KiB

BIN
docs/assets/Qspi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

View File

@ -1,5 +1,7 @@
# SPI
SPI is a serial peripheral interface. The controller selects a chip it send and receive information to and from. NOR flash chips with an SPI interface are commonly used as firmware boot chip. SPI has one read and one write line. In QSPI mode, 4 lines are used in parallel.
### Dump Firmware via SPI
```powershell
@ -11,6 +13,12 @@ sudo flashrom -p linux spi:dev=/dev/spidev0.0,spispeed=1000
sudo flashrom -p linux spi:dev=/dev/spidev0.0,spispeed=1000 -r dump.bin
```
An ESP8266 and ESP32 has several SPI busses available in hardware, SPI0 is hooked up to it's own internal flash and is not intended for use, but the HSPI and VSPI busses can be used in combination with a SOIC-8 clamp to read from SPI NOR chips. cheap clips have a tendency to jump of the chips, pomona 5250 has a better grip.
```powershell
$ python ./esptool.py read_flash --spi-connection HSPI 0 0x400000 flash_dump.bin
```
### SPIFFS
```powershell
@ -21,6 +29,15 @@ $ cd ~/.arduino15/packages/esp32/tools/mkspiffs/0.2.3
$ ./mkspiffs -u /tmp/data -p 256 -b 8192 -s 1028096 /tmp/spiffs/bin
```
### ESP32 Diagrams
Color coded which pins can be connected from the ESP HSPI pins to an SPI flash. The pink interfaces are optional to switch to QSPI
<p align="center">
<img src="../assets/Esp32.png" style="max-width: 400px;"><br />
<img src="../assets/Qspi.png" style="max-width: 400px;">
</p>
### References
* https://www.youtube.com/watch?v=Bn5zajZ4I5E