logo elektroda
logo elektroda
X
logo elektroda

How to Flash Winbond W25Q64, Macronix MX25Lxx, 24C256, STM32, ESP32 Chips: Step-by-Step Guide

User question

ako nahrať flash do čipu

Artificial Intelligence Response

Direct answer to the question

  • In short: identify the exact chip and its interface (SPI/I²C/JTAG/SWD/UART), choose a compatible programmer, back up the original contents, erase the device, program the correct .bin/.hex image at the correct address/offset, and verify the write.
  • Key points:
    • Never write before you make a full backup.
    • Match voltages (1.8 V vs 3.3 V vs 5 V); use level adapters if needed.
    • For in‑circuit work, isolate the target so other circuitry doesn’t fight the programmer.

Detailed problem analysis

  • What “flash a chip” means
    • External non‑volatile memories (most common in consumer gear):
    • SPI NOR (25xxx, e.g., Winbond W25Q64, Macronix MX25Lxx) – 8‑pin SOIC. Stores BIOS/firmware/config.
    • I²C EEPROM (24xxx, e.g., 24C256) – 8‑pin SOIC. Stores small configs/serials.
    • Parallel NOR/NAND (e.g., 29Fxxx, TC58xxx) – large packages; require specialized programmers and ECC handling (NAND).
    • Internal flash inside microcontrollers:
    • AVR/PIC (program via ISP/ICSP), ARM MCUs (STM32 via SWD/JTAG), ESP32/ESP8266 (UART bootloader/USB), NXP, Nordic, etc.
  • Connection modalities
    • Off‑board (desolder and use a socket/adapter): most reliable because the chip is electrically isolated.
    • In‑circuit (clip/ISP header): faster, but other devices on the board can hold the bus or back‑power; often requires holding the main SoC in reset or removing series resistors.
  • Electrical considerations
    • Voltage: many SPI NOR are 3.3 V; newer parts can be 1.8 V (need a 1.8 V adapter). 5 V only for some older EEPROM/parallel parts.
    • Tie SPI /WP# and /HOLD# high through ~10 kΩ if the clip/adapter doesn’t do it.
    • Decoupling: add a 0.1 µF cap close to VCC/GND for off‑board sockets; flaky power equals write/verify errors.
  • Data integrity and uniqueness
    • Dumps often contain device‑unique data (MACs, calibration, keys). Always read and save the original image (e.g., backup_YYYYMMDD.bin) before erasing.

Current information and trends

  • Affordable, capable tools:
    • SPI/I²C flash: CH341A (with proper 1.8 V adapter when needed), EZP2019, TL866II/T48/T56; SOIC‑8 clips and SOP‑to‑DIP adapters are standard.
    • MCU debug: ST‑LINK (STM32), J‑Link (multi‑vendor), Atmel‑ICE (AVR/ARM), PICkit 4 (PIC), ESP flashing via esptool.py with a USB‑UART bridge.
  • Security features increasingly block raw flashing:
    • MCU readout protection/lock bits (STM32 RDP, AVR fuses, PIC code‑protect), debug authentication (ARM TrustZone‑M), and secure‑boot/flash‑encryption (ESP32) prevent reading/replacing code without proper keys.
  • NOR still dominates for BIOS/firmware; QSPI (x4) parts are common. 1.8 V memories are more frequent in newer designs—plan for voltage adaptation.

Supporting explanations and details

  • Typical signal sets you must wire correctly:
    • SPI NOR: VCC, GND, /CS, SCLK, MOSI (SI), MISO (SO), /WP, /HOLD.
    • I²C EEPROM: VCC, GND, SDA, SCL (+ pull‑ups, often 4.7–10 kΩ).
    • SWD (ARM): VCC (sense), GND, SWDIO, SWCLK, NRST.
    • UART bootloaders (ESP/STM32): TX, RX, GND and boot straps (ESP32 EN/IO0; STM32 BOOT0).
  • Hold the host SoC in reset for in‑circuit SPI flashing so it doesn’t contend on the bus; if no reset line is accessible, remove the flash or lift /CS.
  • NAND specifics: page/block sizes and ECC layout must match the target; use a programmer that understands the device’s OOB/ECC scheme.

Ethical and legal aspects

  • Firmware is often copyrighted and may include cryptographic keys unique to the device. Copying firmware between devices can breach licenses or anti‑circumvention laws. Respect warranty terms and right‑to‑repair regulations in your jurisdiction.
  • Never defeat security features on devices you don’t own or have explicit permission to service.

Practical guidelines

  • External SPI NOR (25xxx) – step‑by‑step:
    1. Identify the exact part number; consult the datasheet for voltage and ID.
    2. Decide off‑board (preferred) or in‑circuit (clip). If in‑circuit, unplug all power and, if possible, hold the main CPU in reset.
    3. Connect programmer (e.g., CH341A/TL866) with correct voltage; check Pin‑1 orientation.
    4. Read the chip twice; compare files; save as backup.bin.
    5. Erase -> blank‑check.
    6. Program your .bin at offset 0x000000 unless vendor requires a specific map; then Verify (byte‑for‑byte).
    7. Reinstall and test.
      • Common CLI examples:
      • flashrom: read “flashrom -p ch341a_spi -r backup.bin”; write “flashrom -p ch341a_spi -w new.bin”.
      • TL866/minipro: “minipro -p W25Q64JV -r backup.bin”; “minipro -p W25Q64JV -w new.bin”.
  • I²C EEPROM (24xxx):
    1. Confirm capacity (e.g., 24C02 vs 24C256) and address pins.
    2. Off‑board is best; in‑circuit requires isolating pull‑ups or ensuring the bus is idle.
    3. Read/backup, erase (if supported) or just overwrite, then verify.
  • MCU internal flash:
    • AVR: avrdude + USBasp/Atmel‑ICE; mind fuses (clock source, lock bits).
    • Example: “avrdude -c usbasp -p m328p -U flash:w:app.hex”.
    • STM32: ST‑LINK + ST tools/OpenOCD; set BOOT0=0 (debug), or use UART bootloader.
    • Example (OpenOCD): “program app.hex verify reset exit”.
    • ESP32/8266: USB‑UART + esptool.py; set EN/IO0 for bootloader mode.
    • Example: “esptool.py write_flash 0x0 firmware.bin”.
    • PIC: MPLAB IPE + PICkit; ensure correct VPP/MCLR timing.
    • Nordic nRF: nrfjprog/J‑Link; SoftDevice + app layout matters.
  • Troubleshooting checklist
    • JEDEC ID read fails (FF/00): wrong voltage, mis‑oriented clip, SoC holding bus, bad ground.
    • Verify fails: insufficient VCC/current, long clip wires, missing /WP high, noisy USB port.
    • Device still dead: wrong image/offset, lost unique data (re‑merge from backup), soldering fault, security/boot strapping not satisfied.

Possible disclaimers or additional notes

  • NAND rework and eMMC/UFS require more advanced tools, ECC/BCH handling, and often board‑level bring‑up knowledge.
  • Some devices require signing the image; unsigned code won’t boot even if programmed correctly.
  • Cheap CH341A clones sometimes output incorrect voltages—measure before use.

Suggestions for further research

  • Obtain and study the chip’s datasheet and the device’s service manual/schematics if available.
  • Look up vendor‑specific application notes on in‑system programming and bootloaders.
  • Review best practices for ESD control and hot‑air rework to avoid pad damage.

Brief summary

  • Determine the chip type/interface and correct voltage.
  • Use a suitable programmer and make a verified backup first.
  • Erase, program the correct image at the correct address, and verify.
  • Prefer off‑board programming for reliability; if in‑circuit, electrically isolate the target.
  • Be mindful of security/unique data and legal constraints.

If you share the exact chip marking, device model, and the file you plan to load (.bin/.hex, size), I can give you a pin‑by‑pin wiring diagram, tool choice, and a precise command/script for your case.

Ask additional question

Wait...(2min)
Disclaimer: The responses provided by artificial intelligence (language model) may be inaccurate and misleading. Elektroda is not responsible for the accuracy, reliability, or completeness of the presented information. All responses should be verified by the user.