CuVoodoo

the sorcery of copper

User Tools

Site Tools


dump_spi_flash

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
dump_spi_flash [2021/04/14 19:12] – [in-circuit] kingkevindump_spi_flash [2021/04/19 08:11] – [BX48] add database explorer kingkevin
Line 177: Line 177:
 There I can save read/write the data content, and save/load it. There I can save read/write the data content, and save/load it.
  
-To get the latest chip database (particularly if the Linux release it lagging), here how I update it:+To get the latest chip database (particularly if the Linux release it lagging), here how I update it ([[https://flashdb.cuvoodoo.info/|here]] you can also explore the database):
  
 <code> <code>
Line 228: Line 228:
  
 Note that you need hardware [[https://wiki.segger.com/Software_and_Hardware_Features_Overview|version 10 or later]]. Note that you need hardware [[https://wiki.segger.com/Software_and_Hardware_Features_Overview|version 10 or later]].
-Hardware version 8 does not support SPI flashing, and version 9 releases nCS just before talking to the chip (this seems to be an issue [[https://www.segger.com/downloads/jlink/ReleaseNotes_JLink.html|fixed for version 10 with software version 6.86c from 2020-10-06]] but is still present as of 2021-04-14 with firmware version 2021-02-02 and software version 7.00 from 2021-04-08).+Hardware version 8 does not support SPI flashing, and version 9 releases nCS just before talking to the chip (this seems to be an issue [[https://www.segger.com/downloads/jlink/ReleaseNotes_JLink.html|fixed for version 10 with software version 6.86c from 2020-10-06]] but is still present as of 2021-04-14 with firmware version 2021-02-02 and software version 7.00 from 2021-04-08, and setting CS in the init steps does not solve the issue). 
 + 
 +====== your programmer ====== 
 + 
 +Finally, you can make your own programmer using a micro-controller. 
 +Ideally it has a hardware SPI peripheral (most do), but even software bit-banging is possible because there are no tight tolerances. 
 +This allows to customize the programmer to your needs and setup (regarding voltage level, clock speed, nRST pin of flash and MCU, ...). 
 + 
 +===== electrical electrical ===== 
 + 
 +The most important part is using the right voltage so you don't damage the target chip or board. 
 +Select the right voltage to power the target, if it doesn't already have power on its own. 
 +You can use any level shifter for the data lines (they don't need to be bi-directional). 
 +Connect the target voltage and your MCU voltage on each side, and the job is done. 
 + 
 +===== data interface ===== 
 + 
 +The most common lines are the following: 
 + 
 +  * flash nRST/nHOLD: active low reset line. Set it high so the chip is activated 
 +  * MCU nRST (optional): active low reset line of the micro-controller using the SPI flash on the target board. Hold it low so the MCU does not drive the data lines 
 +  * nWP: active low write protect. Set it low if you only intend to read out the flash and don't want to accidentally erase data. Set it high if you want to write it 
 +  * CLK: clock line with clock polarity: idle low, and clock phase: sample data on rising edge. Since SPI is a synchronous protocol, the data traffic is synchronized to this clock, provided by the master (your programmer). This allows you to set the frequency: very low for more reliable traffic (there is not lower limit), or very high for fast transfer (often up to 100 MHz). The clock also does not need to be periodic (allowing sloppy big-banging implementation) and the edge time not strict (allowing any voltage shifter technology) 
 +  * nCS: chip select line, active low. You must set it low to start a new transaction. It also allows to have multiple flash chips (SPI slaves) on the same data lines (you then just select the one you want to talk too) 
 +  * MOSI/DI: master output slave input (flash chip data input). You will send the commands on this pin 
 +  * MISO/DO: master input slave output (flash chip data output). You will receive the replies and data on this pin 
 + 
 +possible additional aspects (specific for your setup): 
 + 
 +  * some lines (like nRST) might already be set on the board 
 +  * if you don't find the nRST line for the MCU of the target board, there might be inline protection resistor on the lines (you will often have to desolder the flash chip to find them first). Desolder them and connect to the pads on the flash chip side. This way the MCU won't be able to interfere 
 +  * to increase the speed, you can either increase the CLK clock frequency, or use the optional dual/quad-mode capabilities. This can be activated using a command, and might re-use the nWP/nRST pins 
 +  * in theory the data lines need to be driven as push-pull, but you can also drive them as open-drain (allowing using level shifter as the BSS138-based ones). But be aware that the chip will drive DO (and other lines in dual/quad mode) as push-pull 
 +  * each setup is different, and you have to find things out by yourself. Just don't forget to read the appropriate data sheet 
 + 
 +===== instruction interface ===== 
 + 
 +The instructions are sent in 8-bit packets, most significant bit first. 
 +There are a couples of instructions common to most SPI flash chips, which allow you to perform basic operations: 
 + 
 +  * 0x9F, JEDEC ID: you will then read 3 bytes allowing you to identify the chip (manufacturer, memory type, capacity). This is how most programmers verify the chip type 
 +  * 0x03, Read Data: followed by 3 bytes of data where you specify the start address of the data you want to read. After that you can read out as much data as you want
dump_spi_flash.txt · Last modified: 2024/01/07 17:49 by 127.0.0.1