DIY Spi Flash Programmer

Firmware is pre-installed in flash devices before manufacturing a circuit board, while maintaining high throughput. Nevertheless, there are advantages in programming flash memory after its release, that is, before it was soldered to the board. The Spi Flash Programmer (SF) with discrete flash memory has significant advantages over conventional SD. Its price usually does not exceed 1/10 of the cost of a flash drive, uses a much smaller form factor and requires a small amount of special equipment.

Choices: SF & SD

Justification for use: SF & SD




There are many reasons for choosing a discrete flash chip instead of the SD subsystem, or vice versa, so the user needs to make compromises before purchasing a device. The list below contains several arguments that you need to know before choosing a DIP chip or a full SD solution:

  1. Hardware complexity, SF has the advantage. A DIP package with a discrete flash chip is much easier to use than SD.
  2. Software complexity, SF has the edge. The SD flash subsystem typically relies on Fat16 / 32 SD libraries. Although the devices are SPI, it makes sense to use FAT, since any PC / MAC can read the card. These libraries are large and can occupy precious EEPROM space on small embedded controllers.
  3. Capacity and portability, SD has the advantage. You can use a larger capacity SD card in an existing design without change. Discrete SPI has lower density limits.
  4. Cost, SF has the edge.
  5. Power, SF has the edge. SD cards usually have higher leakage power due to higher density and higher dynamic power due to access speed.
  6. Speed, SD has the edge. SD flash memory comes in many different speed-based SKUs, mainly due to the demands of digital photography and the use of raw image formats.

SPI Flash

Flash memory SPI is a type of non-volatile memory based on MOSFET technology. Non-volatile means that the device saves all data, including when not turned on. Flash memory works by transferring a group of charge carriers to a dielectric. This is called programming and is usually performed with a higher voltage. The process is not harmless, it actually damages the material, and after 100 thousand cycles the device crashes. To remove charge carriers from the dielectric, at the same high voltage at the reverse potential, the carriers are removed from the gate. This is called erasure.





The programmed flash bit is 0, and the erased bit is 1, the erased flash byte is 0xFF in hexadecimal format. Flash memory can currently store several bits per cell using voltage levels. Given the increasing demands on memory capacity, it is becoming increasingly difficult to perform structurally.

The advantage of Spi Flash USB programmers is the simplicity of the software, the code basically shifts the data of the DI and DO pins, respectively, on the leading edge of the clock frequency. The clock is controlled by the host, it does not require a fancy synchronization scheme: the phases can be as asymmetric as necessary, subject to the minimum requirements for the device cycle width.

Identification Utility

Flashrom is a utility for identifying, reading, writing, checking, and deleting flash chips. It is designed to flash BIOS / EFI / coreboot / firmware / optionROM images on motherboards, network controller / graphics / storage cards, and various other programming devices. Functionality:

  1. Supports more than 476 flash memory chips, 291 chipsets, 500 motherboards, 79 PCI devices, 17 USB devices and various Spi Flash programmers based on parallel / serial ports.
  2. It supports parallel interfaces, LPC, FWH and SPI flash memory interfaces and various chip packages (DIP32, PLCC32, DIP8, SO8 / SOIC8, TSOP32, TSOP40, TSOP48, BGA and others).
  3. Physical access is not required, root access is sufficient or not required at all for some programmers.
  4. No boot diskette, CD-ROM, or other media is required.
  5. Keyboards and monitors are not required; they are simply flashed remotely via SSH.
  6. No instant reboot required.
  7. They rewrite the chip in a working system and check it, the new firmware will work at the next boot.
  8. Partial Windows support is available.

DIY: universal creation programs

DIY universal




This is the best Spi Flash programmer for PIC and AVR microcontrollers, maybe you can’t create it yourself, but the device is not expensive, costs less than $ 10 and is made from easily accessible components.





Benefits:

  1. Free open source software.
  2. No need to install additional drivers, uses the HID (Human Interface Device) driver, which is usually used for keyboard and mouse.
  3. Supports many PIC and AVR devices.
  4. Supports Windows and Linux platforms.
  5. It consists of a PIC18F2550 microcontroller - the brain of the Spi Flash programmer.
  6. The USB-B connector connects to a computer.
  7. There are two LED indicators, one to indicate the connection of the programmer, the other shows the programming status.

Microcontroller PIC18F2550

Microcontroller PIC18F2550




The main three consecutive headers (J1, J2 and J3) are used to communicate with the microcontroller slave. The use of conclusions is different in different microcontrollers. A reset switch is added to the controller block to set the reset of the programmer. The PIC18F2550 blinks with a hexadecimal firmware code; other serial or parallel Spi Flash PIC programmers can be used.

He checks the connection between the microcontroller and the PC. HID detection (Human Interface Device) is required, which will fix many errors, such as problems with the microcontroller, crystals, and USB. Before using the program, make sure that the LED flashes, which then slows down the flashing process. If no programmer is found, check for cross-connections and instructions. If it is detected, proceed to the next step.

Programming through OpenProg

Programming through OpenProg




Install the OpenProg program on a PC, start and test the connected device. Spi Flash programmer firmware sequence:

  1. Connect the USB connector to the PC.
  2. Open OpenProg and make sure that the programmer is detected.
  3. Click “Parameters” -> “Test equipment”.
  4. Perform a hardware test. It checks all programming contacts, and the user can easily debug the device when errors are detected.
  5. The hardware test shows the voltage on VODU, VPPU, CLK, DATA, PGM at different points in time, which is important to consider when doing the Spi Flash programmer on your SMD with your own hands.
  6. Measure the voltage between the terminals VODU, VPPU, CLK, DATA, PGM and check its values ​​on the screen.
  7. VPP may have a 1V difference due to AC to DC conversion.
  8. If the voltage of these pins of the controller part and what is displayed on the screen are similar, the programmer works fine.
  9. If the voltage is different, check the circuit of the corresponding contacts.

PCB design

PCB design




This circuit board is designed in Eagle 7.2. The plate size is 7.5 x 7 cm, it is made on an automatic etching machine. A printed circuit board can also be made using chemical etching at home.

Components JA, JB, JC are jumpers. According to the scheme, this is carefully checked and first, during assembly of the components, jumpers are installed. To ensure the safety of the PIC18F2550, a 28-pin IC base is used during soldering.

An expansion board connects the programmer to the microcontroller. Different series of microcontrollers have different contacts and configuration for programming. This gives users an advantage in the ease of programming the microcontroller.

An expansion board can be easily made using a perforated board or in special blanks for boards purchased from a distribution network. For microcontroller series, different expansion cards are used. For LVICP from 5 V to 3.3 V, a voltage regulator such as LM1117 or similar is required.

A 3.3 V device must only be programmed using a 3.3 V expansion board, otherwise permanent damage may occur. Some of the boards have a 5 V option. If you need to program at 5 V, you can select the option “Do not require low voltage board”. It is also not recommended to place the 24F-33F in the 30F socket, which operates at 5 V.

Completion of the creation process

Completion of the creation process




After manufacturing the controller part and expansion board, you can immediately proceed to programming the device:

  1. Find the device and device series for programming.
  2. Choose the appropriate device expansion card.
  3. Connect the device to the expansion card.
  4. Attach the expansion card to the controller unit.
  5. Connect the USB B connection cable to the programmer and to the PC.
  6. Open OpenProg.exe and make sure that the programmer is detected.
  7. Open the device and select the one you need for programming.
  8. Click the green arrow at the top to read the device.
  9. For recording / firmware, press the left button on the top to select the “.hex” code, and press “Ok”.
  10. Press the red arrow button next to the green arrow button to program the device.
  11. Make sure that the LED flashes during programming, indicating the status of the process.
  12. Check the result and make sure that the blink is successful.
Software programming status




Serial SPI AT45DB161D

Simple Spi Flash Programmer SPI (AT45DB161D) is a 16-megabyte (2 MB) 2.5 V or 2.7 V flash memory with a serial interface, ideal for a wide range of applications designed to store program code and data.

A total of 2097152 bytes (0x1FFFFF) are organized into 4096 pages with 512 bytes per page. Despite the fact that the chip offers various erasure options, the software library supports erasing blocks, with one block containing 4 KB.

To overwrite existing data, you must first delete the corresponding block. Reading and writing data is done in a rather simple way, mainly by providing a read / write address (from 0 to 0x1FFFFF) and information about the length of the data. Using existing basic functions, you can extend the code to support an extensive file access system.

USB EEPROM

USB EEPROM




The Spi Flash EEPROM 25 series programmer with software and driver support and 25-SPI flash memory 8-pin / 16-pin has the following features:

  1. Automatic identification chip model 25 series.
  2. USB support in TTL.
  3. Automatic detection of a chip of a series 25.
  4. Support download STC series.
  5. Spi Flash ch341a STC programmable microcontroller procedure supports a full range of software downloads for a variety of software: backup, erase, program, calibrate and other movements.
  6. Provides a power output of 5 V - 3.3 V.
  7. Size: 70 mm x 27 mm
  8. CH341SER.EXE - self-installation of the archive from USB to the serial driver.

Troubleshooting Microcontrollers

When a user starts working with microcontrollers, he will probably encounter programming problems that will take hours or days to solve, and sometimes they are simply unsolvable. Experienced programmers shared their best practices for resolving various violations, here are some of them:

  1. If there is any failure, first check the power supply. Sometimes it happens that the power source does not fit the programmer and requires an external power source.
  2. Choose the correct serial port in the software.
  3. Before using the programmer, you must install the drivers necessary for its functioning. When the programmer is connected for the first time, it automatically installs them, if there is an Internet connection, sometimes you need to specify the location of the drivers.
  4. Voltage increase. Many microcontrollers require pull-ups in their circuit before they can be programmed, since the picase microcontroller requires a 10 kOhm pull-up resistor on the serial output, otherwise it shows an error.
  5. The programming software does not detect the microcontroller - this is again a problem with the power supply, they check the power supply again and connect the programmer to the computer.

After doing the Spi Flash USB programmer with his own hands, the user will receive an SF made by himself for system programming. It will be easily controlled by a computer via the USB bus thanks to a convenient interface and powerful functions.




All Articles