Giter Site home page Giter Site logo

ttyant / serprog-stm32vcp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dword1511/serprog-stm32vcp

0.0 2.0 0.0 881 KB

STM32F103-based flash programmer with coreboot flashrom serprog protocol and USB CDC interface

License: GNU General Public License v3.0

Makefile 5.26% Eagle 11.08% C 83.08% C++ 0.57%

serprog-stm32vcp's Introduction

serprog-stm32vcp:

flashrom serprog programmer based on STM32F103 MCU & USB CDC protocol.

Prebuilt firmware binaries: http://dword1511.info/dword/projects/serprog-stm32vcp/prebuilt/

Source archives: http://dword1511.info/dword/projects/serprog-stm32vcp/


Features

  • Cheap and simple hardware:
    • a STM32F103 series MCU
    • a crystal
    • a 3.3V LDO
    • one or two LED(s)
    • some capacitors, resistors and wiring.
  • Hardware full-duplex SPI with DMA, multiple clock speeds available:
    • 36MHz
    • 18MHz
    • 9MHz (Default)
    • 4.5MHz
    • 2.25MHz
    • 1.125MHz
    • 562.5kHz
    • 281.25kHz
  • Hardware USB2.0 FullSpeed PHY with buffer, efficient virtual COM port emulation with USB CDC protocol.
  • Fully functional status LED.
  • flashrom serprog protocol.
  • No UART device or settings needed, operates at ANY baud rates.
  • Fully polled, double buffer operation, no glitches.
  • Read speed up to 850KiB/s @ 36MHz SPI operation.
  • Support 25 and 26 series SPI flash chips. 45 series is NOT supported by flashrom.
  • Support LPC / FWH flash via parallel programming. [WIP]

Advantages

  • Fast:

    With ARM Cortex-M3 CPU @ 72MHz / 61DMIPS, 36MHz SPI engine, multi-channel DMA engine & on-chip USB 2.0 Full-Speed controller, serprog-STM32VCP is MUCH faster than many commercial CH341A-based USB programmers which are widely sold in China. Benchmark data can be found in the PERFORMANCE file.

  • Convenient:

    Built-in Virtual COM Port emulation, no USB-to-UART bridge needed. Fully compatible with flashrom serprog protocol version 0x01.

  • Stable:

    Main program is fully polled, not interrupt-driven. No physical UART means no baud rate and interference trouble. Natural 3.3V operation voltage.

  • Affordable:

    STM32F103C8T6 cost only ~$1.5 and its minimized develop board usually cost less than $6 in China (MCU, USB and status LED included).

Ironically, you will still have to buy or borrow a USB-to-UART bridge (not RS-232 but TTL level) to program the programmer itself.


Installation

  1. Download following software if you do not have them.
  • flashrom, of course
svn co svn://flashrom.org/flashrom/trunk flashrom

Or simply:

sudo apt-get install flashrom
  • summon-arm-toolchain
git clone git://github.com/esden/summon-arm-toolchain.git

Edit summon-arm-toolchain, turn on LIBSTM32_EN and turn off LIBOPENCM3_EN, then run it. If you have already got an arm-none-eabi toolchain with libstm32, you may skip this.

  • stm32flash
svn co http://stm32flash.googlecode.com/svn/trunk/ stm32flash
make && sudo make install
  1. Modify the Makefile if needed.

Point TOOLCHAIN to the right path. If toolchain path is in the $PATH variable, simply leave the "arm-none-eabi-" string here.

  1. Compile.

Simply type:

make
  1. Program.

Look at your STM32F103 board, find the BOOT0 jumper or ISP switch, put it into high or enabled, then connect you board's UART to your computer with the USB-to-UART bridge, apply power to your board, then type:

make program
  1. Done!

Throw the USB-to-UART bridge away and enjoy. Do not forget to pull BOOT0 low before resetting the board.


Usage

  1. To read a flash chip:
  • Connect an 25 type SPI Flash to your board according to the file SCHEMATICS.
  • Connect your board to your PC via USB.
  • Type:
flashrom -p serprog:dev=/dev/ttyACM0:4000000 -r file-to-save.bin
  • Some times flashrom will ask you to choose a chip, add something like:
-c SST25VF040B

This is because sometimes multiple device with different timing requirements are only distinguished by the device code, however currently flashrom will not read it. Besides, some flash chips support more than one instruction sets.

  1. To erase a flash chip:
  • Erase is automatically done when writing. However, if you simply want an empty chip, you will need to erase manually.
  • Type:
flashrom -p serprog:dev=/dev/ttyACM0:4000000 -E
  • For certain chips like MX25L6445E, first pass could fail with old flashrom version, but if you do a second pass, all things will be alright. Seems like the first block needs more delay to be erased.
  • Flash status are verified to be empty automatically.
  • The whole process can take a few minutes.
  1. To write a flash chip:
  • Type:
flashrom -p serprog:dev=/dev/ttyACM0:4000000 -w file-to-load.bin
  • Flash chips are checked and blocks that are not empty are automatically erased.
  • Images are verified after writing automatically.
  • The whole process can take a few minutes.

About the LED

  • [READY] on, [BUSY] off:

    Device is idle.

  • [BUSY] on, [READY] off:

    Waiting for USB to be configured. If this happens during read/rease/write procedure and hangs for too long, it is possible that a firmware bug occured. Please report to me, better with the output of the strace tool.

  • [BUSY] flashes:

    Reading flash.

  • [BUSY] and [READY] alternating:

    Erasing flash.

  • [BUSY] and [READY] on:

    Writing (actually alternating fast but you cannot see it :) ).


Problems?

  1. If encountered something like "Error: Cannot open serial port: Device or resource busy", please try to stop or remove modemmanager.
  2. Check your wirings and flashrom version. Do not forget to power the flash chip itself.
  3. If you are sure it is caused by something wrong in the programmer's firmware, please file a ticket.

serprog-stm32vcp's People

Contributors

dword1511 avatar hexum avatar

Watchers

James Cloos avatar ttyant avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.