GithubHelp home page GithubHelp logo

dword1511 / stm32-vserprog Goto Github PK

View Code? Open in Web Editor NEW
305.0 20.0 90.0 425 KB

flashrom serprog programmer based on STM32 MCU & USB CDC protocol. Uses libopencm3 and deprecates the old serprog-stm32vcp project.

License: GNU General Public License v3.0

Makefile 12.56% C 87.44%

stm32-vserprog's Introduction

stm32-vserprog:

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

This project deprecates previous serprog-stm32vcp project, which uses STMicro's proprietary firmware library. Most functions are the same.


Features

  • Fully open-source: now with libopencm3 instead of STMicro's proprietary firmware library.
  • Affordable and simple hardware:
    • An STM32F103C8T6 MCU, an 8MHz crystal, a 3.3V 1117 LDO, some 0805 capacitors, resistors and LEDs along with dedicated PCB available on OSH Park (V2 or V3)
    • Or some general-purpose STM32 development boards, just add a new header file under "boards" folder to assign correct GPIO for USB D+ pull-up (STM32F1 only) and LEDs.
    • Hardware USB 2.0 Full-Speed and efficient virtual COM port with USB CDC protocol operates at any baud rates, eliminates the need of USB-to-UART bridges and the headache that comes with them.
    • 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, unless you are using an STM32F0x2 device (which has USB ISP capability) or boards with embedded ST-Link (see @FabianInostroza's fork).
  • Hardware full-duplex SPI with DMA, multiple clock speeds available (default at the one closest to but under 10MHz), e.g. on STM32F103 targets:
    • 36MHz
    • 18MHz
    • 9MHz (Default)
    • 4.5MHz
    • 2.25MHz
    • 1.125MHz
    • 562.5kHz
    • 281.25kHz
  • 2 status LEDs (controlled with 1 GPIO):
    • Busy is lit during operation (inverse for boards with only one LED).
    • Different operations cause different patterns of blinking: mostly busy = reading, both on = writing, flashing alternatively = erasing.
    • Busy blinks alone if a hard fault or NMI is detected. Please unplug and replug the programmer. If the situation persists, please consider opening a new ticket.
  • flashrom "serprog" protocol:
    • Operates on all major platforms (see flashrom wiki).
    • Driver-free on Linux. On Windows may require ST's VCP driver (or just hack the .inf file of other CDC drivers, not confirmed).
  • Firmware is interrupt-free except for low-level USB handling -- robust, easy to debug and modify.
  • Fast:
    • Read speed up to 850KiB/s @ 36MHz SPI operation.
    • Dumps an EN25Q64 in 11 seconds and programs in 85 seconds (including flashrom's calibration time).
    • Way faster than many commercial CH341-based USB programmers, especially for reading.
  • Supports 25 and 26 series SPI flash chips. 45 series flash chips have different pinouts. Thus for the V2 PCB mentioned above, you will need an adapter.

Installation

  1. Install stm32flash and the gcc-arm-none-eabi toolchain.

On Debian, simply do the following:

sudo apt-get install stm32flash gcc-arm-none-eabi

NOTE: some systems may require installing newlib (e.g. libnewlib-arm-none-eabi) manually. See #27.

  1. Clone and compile.

Simply type (change the board name accordingly, for details see the header of the Makefile or just type make):

git clone --recurse-submodules https://github.com/dword1511/stm32-vserprog.git
make BOARD=stm32-vserprog-v2
  1. Program.

Connect the USB-to-UART bridge to your computer first. Then connect TXD and RXD lines to your STM32 board with wires. On V2 or V3 boards mentioned above, connect BOOT0 (labeled BT0 on boards) to the 3.3V output of the USB-to-UART bridge. For other boards, find the BOOT0 jumper or ISP switch, put it into high or enabled. On some boards, you will also need to ensure BOOT1 is pulled low. Then, connect your STM32 board to your computer via USB to power it up. Finally, type:

make BOARD=stm32-vserprog-v2 flash-uart
  1. Done!

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


Usage

The following assumes Linux platform, and that the programmer appears as /dev/ttyACM0.

  1. To read a flash chip:
  • Connect a 25 type SPI Flash to the board's DIP-8 slot or according to the schematics.
  • Connect your board to your PC via USB.
  • Type:
flashrom -p serprog:dev=/dev/ttyACM0:4000000 -r file-to-save.bin
  • Sometimes flashrom will ask you to choose a chip, add something like:
-c SST25VF040B

This is because sometimes different devices with distinct timing requirements can only be distinguished by the device code, however currently flashrom will not read it as it is not returned by the RDID command.

  1. To erase a flash chip:
  • Erase is automatically done during 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, the first pass could fail with some old flashrom version, but if you try a second pass, everything will be alright. Seems that the first block needs more delay to be erased.
  • Flash contents 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.

Problems?

  1. If you 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 if operating on a breadboard or prototype board.
  3. If you are sure it is caused by bugs in the programmer's firmware, please open a new ticket and provide details, e.g. the board you are using and flashrom's output. I appreciate your feedback.

stm32-vserprog's People

Contributors

arthurheymans avatar camoz avatar dmsc avatar dword1511 avatar eitetsu0 avatar mytbk avatar neuschaefer avatar ntemis avatar persmule avatar solartraveler avatar swiftgeek avatar thefallenidealist avatar vondraussen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stm32-vserprog's Issues

stm32-bluepill failed to init device

Hi,
I am trying to install this on my stm32-bluepill via a CJMCU-FT232H, but I just get "failed to init device". I am new to this and I am not completely sure what is going on. I think my wiring is correct, and I specified "BOARD=stm32-bluepill" in the make program. Would you mind helping me figure this out?

Unable to get past make BOARD=stm32-bluepill

It seems I cannot get past this. Tried POP_OS and mint.

Here is a copy of the error code

mint@mint:~/stm32-vserprog$ sudo make BOARD=stm32-bluepill
First run, cleaning...
make[1]: Entering directory '/home/mint/stm32-vserprog'
rm -f vserprog.o usbcdc.o spi.o README.html stm32-vserprog.elf stm32-vserprog.hex stm32-vserprog.bin stm32-vserprog.map stm32-vserprog.out board.h last_board.mk
make[1]: Leaving directory '/home/mint/stm32-vserprog'
make[1]: Entering directory '/home/mint/stm32-vserprog'
git submodule init
git submodule update --init
CFLAGS="-O3 -Wall -g3 -gdwarf -std=gnu99 -fno-common -ffunction-sections -fdata-sections -funit-at-a-time -fgcse-sm -fgcse-las -fgcse-after-reload -funswitch-loops -DSTM32F1 -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Ilibopencm3/include/ " make -C libopencm3 lib/stm32/f1 PREFIX=arm-none-eabi- V=1
make[2]: Entering directory '/home/mint/stm32-vserprog/libopencm3'
  GENHDR  include/libopencm3/stm32/f0/irq.json
./scripts/irq2nvic_h ./include/libopencm3/stm32/f0/irq.json;
/usr/bin/env: ‘python’: No such file or directory
make[2]: *** [Makefile:59: include/libopencm3/stm32/f0/irq.json.genhdr] Error 127
make[2]: Leaving directory '/home/mint/stm32-vserprog/libopencm3'
make[1]: *** [Makefile:116: libopencm3/lib/libopencm3_stm32f1.a] Error 2
make[1]: Leaving directory '/home/mint/stm32-vserprog'
make: *** [Makefile:64: all] Error 2
mint@mint:~/stm32-vserprog$ 

flashrom Git URL needs updating

I tried to pull and compile this repo and it fails because of flashrom. The Git URL of flashrom submodule should be updated from:

[submodule "flashrom"]
	path = flashrom
	url = https://www.flashrom.org/git/flashrom.git
	branch = staging

to:

[submodule "flashrom"]
	path = flashrom
	url = https://github.com/flashrom/flashrom.git
	branch = master

It would then compile without errors.

Dead submodule 'flashrom'

On git submodule update got this.

Fetched in submodule path 'flashrom', but it did not contain 31969e9e13d3b138a4e42ca71692c03b0d073382. Direct fetching of that commit failed.

几个问题,望回复

花了10.8买了一个stm 的demo板
原理图:
http://lzdz.f3322.net:81/serprog-stm32vcp/STM32F103C8T6最小系统原理图.pdf
照片:
http://lzdz.f3322.net:81/serprog-stm32vcp/1.jpg
http://lzdz.f3322.net:81/serprog-stm32vcp/2.jpg
http://lzdz.f3322.net:81/serprog-stm32vcp/3.jpg
也不清楚这个stm32 F103C8T6的真假,反正我是看不出来。

1、编译使用:
make BOARD=stm32-vserprog-v2
make BOARD=stm32-vserprog-v3
生成的固件简单测试都能读写,不知道那个更匹配我的的这个板
USB D+(PA12)因这个板上有3.3v的接线端子,所以我直接焊了一个1.5k的1/4瓦的电阻上去了。

2、led的问题,修改配置
boards/stm32-vserprog-v2.h

/ * org
#define BOARD_RCC_LED RCC_GPIOA
#define BOARD_PORT_LED GPIOA
#define BOARD_PIN_LED GPIO0 * /
/ * mod * /
#define BOARD_RCC_LED RCC_GPIOC
#define BOARD_PORT_LED GPIOC
#define BOARD_PIN_LED GPIO13
/ * mod end * /
#define BOARD_LED_HIGH_IS_BUSY true

然后连接在pc13上的led灯工作了
led状态我观察了下,有如下几种:
1、长亮(IDLE?)
2、频率大概一秒的闪烁(不知道什么状态)
3、读flash的时候快速闪烁(灭的占空比高)
4、擦除flash的时候快速闪烁(亮的占空比高)
5、写flash的时候基本不灭(仔细观察感觉亮的占空比更高)
望告知1-2的状态,另外不知道3-5的状态是否正确

3、我的这个demo板用了2个晶振,那个接PC14,PC15的晶振taobao的介绍说是爱普生的32768Hz的,不知道能不能利用它,让读写的速度更快些,谢谢

Build is failing on xenial

make --directory=lib/stm32/f1 SRCLIBDIR="/media/demetris/c4487cfd-d71a-441b-b83d-23d8ce19475d/stm32-vserprog/libopencm3/lib"
make[3]: Entering directory '/media/demetris/c4487cfd-d71a-441b-b83d-23d8ce19475d/stm32-vserprog/libopencm3/lib/stm32/f1'
CC i2c_common_v1.c
arm-none-eabi-gcc -Os -Wall -Wextra -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -Wundef -Wshadow -I../../../include -fno-common -mcpu=cortex-m3 -mthumb -Wstrict-prototypes -ffunction-sections -fdata-sections -MD -DSTM32F1 -ggdb3 -O3 -Wall -g -fno-common -ffunction-sections -fdata-sections -funit-at-a-time -fgcse-sm -fgcse-las -fgcse-after-reload -funswitch-loops -DSTM32F1 -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Ilibopencm3/include/ -o i2c_common_v1.o -c ../common/i2c_common_v1.c
../common/i2c_common_v1.c: In function 'i2c_write7_v1':
../common/i2c_common_v1.c:485:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
for (size_t i = 0; i < n; i++) {
^
../common/i2c_common_v1.c:485:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
../common/i2c_common_v1.c: In function 'i2c_read7_v1':
../common/i2c_common_v1.c:507:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
for (size_t i = 0; i < n; ++i) {
^
../../Makefile.include:44: recipe for target 'i2c_common_v1.o' failed
make[3]: *** [i2c_common_v1.o] Error 1
make[3]: Leaving directory '/media/demetris/c4487cfd-d71a-441b-b83d-23d8ce19475d/stm32-vserprog/libopencm3/lib/stm32/f1'
Makefile:63: recipe for target 'lib/stm32/f1' failed
make[2]: *** [lib/stm32/f1] Error 2
make[2]: Leaving directory '/media/demetris/c4487cfd-d71a-441b-b83d-23d8ce19475d/stm32-vserprog/libopencm3'
Makefile:102: recipe for target 'libopencm3/lib/libopencm3_stm32f1.a' failed
make[1]: *** [libopencm3/lib/libopencm3_stm32f1.a] Error 2
make[1]: Leaving directory '/media/demetris/c4487cfd-d71a-441b-b83d-23d8ce19475d/stm32-vserprog'
Makefile:51: recipe for target 'all' failed
make: *** [all] Error 2

驱动这块会不会有问题?

从打板到元器件采购到组装焊接再到编译烧录程序这整个流程都没有问题,但在Windows10/Linux系统的主机上使用时却无法正常识别出来,指示灯正常工作
PS:第一次插上去时在设备管理器中有个未知设备一闪而过,之后一点反应都没有
不知道是不是因为当时误把22千欧(片上标识为223)的贴片电阻用在R2和R4的缘故,不过现在已经换回来了
除此之外该排查的地方也都排查过了,仍未确定问题所在。。。

Which stm32 should I use

Hello, i am work notebook repair bussiness and i am work with bios most time. I have a genius g540 programmer and is so slow. I am decide to build your programmer but i see first this page"https://github.com/dword1511/serprog-stm32vcp" and you say STM32F103C8T6 48pin in readme but mcu is different in the schematic pdf STM32F103Rxxx an i am buy STM32F103R8T6, it is 64pin. I saw later this version of the programmer but same confusing happen to me again , you say STM32F103C8T6 but in the schematic mcu is STM32F103C(B)T6 . I am good electronic skill but i do not understand modern digital mcu's so much :) . I am download also prebuilt binaries from here "http://dword1511.info/dword/projects/serprog-stm32vcp/prebuilt/" My question is can i use STM32F103R8T6 and if i use which hex or bin and schematic correct, and also missing in the first schematic xtal (i know 8mhz and 2x15 or 22pf) and a lot of parts value, correct uart pin points . If i not use then which mcu can i buy ?
"http://www.direnc.net/STM32F103CBT6-MCU-32BIT-CORTEX-M3-72MHZ-LQFP-48,PR-23142.html"
"http://www.direnc.net/STM32F103C8T6-MCU-32BIT-CORTEX-M3-72MHZ-LQFP-48,PR-23141.html"
"http://www.direnc.net/STM32F103C8T6-Mini-Development-Board-ARDUINO,PR-22302.html"
"http://www.direnc.net/ARM-Cortex-M3-STM32F103C8T6-STM32-development-board,PR-15818.html"
I am so sorry for my English, i know messed up the spech. Thanks.

Any recommended hardware?

Does anybody recommend a specific board or setup for building a new dedicated plcc programmer today?

Thanks so much for any information.

Compile error when building for stm32-tiny042-v1

There is an issue when building for stm32-tiny042-v1 or any stm32f0x boards

$ make BOARD=stm32-tiny042-v1
ln -sfT "boards/stm32-tiny042-v1.h" board.h
arm-none-eabi-gcc -O3 -Wall -g -fno-common -ffunction-sections -fdata-sections -DSTM32F0 -mthumb -mcpu=cortex-m0 -msoft-float -Ilibopencm3/include/  -c vserprog.c -o vserprog.o
In file included from vserprog.c:14:0:
vserprog.c: In function 'handle_command':
spi.h:11:42: error: 'GPIO_SPI1_NSS' undeclared (first use in this function)
 #define SPI_SELECT()   gpio_clear(GPIOA, GPIO_SPI1_NSS)
                                          ^
vserprog.c:193:7: note: in expansion of macro 'SPI_SELECT'
       SPI_SELECT();
       ^
spi.h:11:42: note: each undeclared identifier is reported only once for each function it appears in
 #define SPI_SELECT()   gpio_clear(GPIOA, GPIO_SPI1_NSS)

赞,blog.dword1511.info无法评论,只有在这里评论了,附带一些文件下载地址

非常不错,用10多元钱的stm32做了一个一次成功。
测试环境win7_x64+VirtualBox(ubuntu 18.04_64),使用USB xHCI模式。
为什么用xHCI 因为我测试过在其它项目中usb使用xHCI 模式比EHCI的通讯速度快不少。
测试芯片winbond 25Q32FVSIG (4MBye),下面的结果是多次测试取的平均值:
读:6.255秒 657KByte/s ,擦除 45.69s ,写50.10s 81.74KByte/s
(以上测试用的20030331的固件).

1、在linux下的用的是flashrom1.2,自己静态编译的版本i386版本(我发现在ub 16.04下动态编译的版本在ub18.04下尽然不能用)就索性编译了一个i386的静态flashrom。下载地址:
http://lzdz.f3322.net:81/serprog-stm32vcp/flashrom1.2_i386_static.tar.gz
同样stm32flash也编译了一个,下载地址:
http://lzdz.f3322.net:81/serprog-stm32vcp/stm32flash_i386_static.tar.gz

2、windows 下也测试成功了,但是安装那个stm vcp费了点功夫,看了帖子
http://www.openedv.com/forum.php?mod=viewthread&tid=72803
才解决了stm vcp安装后驱动出现感叹号的问题。
下载地址:
http://lzdz.f3322.net:81/serprog-stm32vcp/stm_vcp_usb缺少的文件.zip
stm_vcp1.4下载地址:
http://lzdz.f3322.net:81/serprog-stm32vcp/stm_VCP_1.4.zip
stm_vcp1.5下载地址:
http://lzdz.f3322.net:81/serprog-stm32vcp/stm_vcp_1.5_en.stsw-stm32102.zip
当然不会少了flashrom(别人编译的,版本1.1)下载地址:
http://lzdz.f3322.net:81/serprog-stm32vcp/flashrom_win_v1.1.zip
使用方法:
flashrom.exe -p serprog:dev=comX:115200,spispeed=36000000 -r nul
但是我不知道怎么在win7 下计算时间,谁有办法,望告知,谢谢

Native 4-byte addressing

It would be nice to support larger-capacity SPI NOR flash chips like W25256FV and N25Q256A that require 4-byte addressing.

Can build in window 7 ?

Hello dword, I'm very glad found your git from forum stm32ardunio.. i try complie in windows but failed.

How to use udev rules to make a symbol link of /dev/ttyACM<N>

First let's see how 'Black Magic Probe' did this:

$ udevadm info --attribute-walk /dev/ttyACM0
  looking at device '/devices/pci0000:00/0000:00:1a.1/usb4/4-1/4-1:1.0/tty/ttyACM0':
    KERNEL=="ttyACM0"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:1a.1/usb4/4-1/4-1:1.0':
    KERNELS=="4-1:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="cdc_acm"
    ...
    ATTRS{interface}=="Black Magic GDB Server"

And it's udev rules like this:

DRIVERS=="cdc_acm", ATTRS{interface}=="Black Magic GDB Server", SYMLINK+="bmp_gdb"
DRIVERS=="cdc_acm", ATTRS{interface}=="Black Magic UART Port", SYMLINK+="bmp_uart"

But stm32-vserprog has no such thing like ATTRS{interface} :

$ udevadm info --attribute-walk /dev/ttyACM2
  looking at device '/devices/pci0000:00/0000:00:1d.2/usb8/8-2/8-2:1.0/tty/ttyACM2':
    KERNEL=="ttyACM2"
    SUBSYSTEM=="tty"
    DRIVER==""
  looking at parent device '/devices/pci0000:00/0000:00:1d.2/usb8/8-2/8-2:1.0':
    KERNELS=="8-2:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="cdc_acm"
    ...
    ATTRS{supports_autosuspend}=="1"

So, how to add "ATTRS{interface}" to stm32-vserprog ?

Nucleo F411RE: more than header config?

Im guessing the nucleo board stm32f411RE is a bit different with pinouts, and I would have to configure more than just a header file in boards/ , right?

I would have to modify stm32/common/gpio_f24.h? Or, do I use the gpio letter groups from there to update a new file, naming it in boards/nucleo_blackpill.h?

what should i do to make this work. Also what about WP, HOLD?

852B2501-DF20-4113-8215-E04A899579D1

2C54A56E-2137-4AC4-A979-FFEAED70FBFE
C812DD40-87C9-482C-9D80-F8EA5252B6F4

PA_5: LED , spi1_SCLK
PA_6: SPI1_MISO
PA_7:SPI1_MOSI
PA_15: SPI1_SSEL

(CN5 CN6 CN8 CN9 are arduino headers…not what im looking for.)

Works fine on MacOS (M1 Mac)

Hello -- thanks for a great project!

I just wanted to note for other readers searching the issues that this worked fine on my M1 Mac running MacOS 12.2.1 just by downloading gcc-arm-none-eabi and adding it to my $PATH.

If you're interested in incorporating this into the README, I'd be more than happy to refactor this into a PR! If not please close the issue, no worries.

My process:

  1. On STM32: move jumper closer to the edge from 0->1
  2. Put FTDI at 3.3v
  3. Connect the (unplugged) FTDI to the STM32 (remember: Tx goes to Ten)
FTDI STM32
TX A10
RX A9
3V 3V
GND GND
export SERIAL=/dev/tty.usbserial-00000000 # or whatever the device is in your case

wget 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-mac.tar.bz2'
tar -xjf gcc-arm-none-eabi-10.3-2021.10-mac.tar.bz2
PATH+=:"$(pwd)"/gcc-arm-none-eabi-10.3-2021.10/bin
export PATH

git submodule add https://github.com/dword1511/stm32-vserprog.git`
git submodule update --init --recursive`
cd stm32-vserprog/
make BOARD=stm32-vserprog-v2
make BOARD=stm32-vserprog-v2 flash-uart
$ flashrom -p serprog:dev="${SERIAL}"
... works fine

I was adding this to an existing git project, so instead of the submodule business above, most users will probably want to use git clone --recurse-submodules as per the README.

~~x�~hellowor problem

Thank you so much for your code, it helped me a lot. But I have a problem. When I start up my stm32f103 device and try to read 14 bytes from virtual port by using usb_getc(), First 6 bytes are always like ~~x�~ these. I understood that they stay there when I start up system and if I write 14 bytes, I can only write first 8 bytes The first 6 bytes already occupied by these characters.
Do you have any suggestion and thanks a lot for the code you support.

XTW2 flasher support

I ghink the issue is that different chips are used
xtw100 has stm32f103
xtw2 has gd32f103
chip.

I have a XTW100 and one XTW2.
Unlocked both via SWD and flashed the XTW100 board code.

The XTW100 works perfect but the XTW2 doesn't.
one difference is
xtw100 has stm32f103
xtw2 has gd32f103
chip.

As far as I can tell the PA2 and PA3 are still the same for WP / HOLD.
VCC is connected to the AMS1117.
Ground is much better and connected to the board ground.
CS -> PA4
DO -> PA6
GND -> VSS
DI -> PA7 / PB0
CLK -> PA5

I have removed the lines

  gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO1|GPIO2);
  gpio_clear(GPIOB, GPIO1|GPIO2);

but this doesn't work either.

I can build it, flash it.
But in flashrom I only get to the point where it probes for the first chip
and than it just hangs.

blackout@Workstation ~ % sudo flashrom -p serprog:dev=/dev/ttyACM0:400000 -r h.bin -VVV 
flashrom v1.2-85-gf4eeefd8 on Linux 5.10.15-arch1-1 (x86_64)
flashrom is free software, get the source code at https://flashrom.org

flashrom was built with libpci 3.7.0, GCC 10.1.0, little endian
Command line (5 args): flashrom -p serprog:dev=/dev/ttyACM0:400000 -r h.bin -VVV
Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Initializing serprog programmer
Using custom baud rate.
serprog: connected - attempting to synchronize
writecnt 8 wr_bytes 0
wrote 8 bytes
write successful
writecnt 1 wr_bytes 0
wrote 1 bytes
write successful
.readcnt 1 rd_bytes 0
read -1 bytes
readcnt 1 rd_bytes 0
read 1 bytes
readcnt 1 rd_bytes 0
read 1 bytes
writecnt 1 wr_bytes 0
wrote 1 bytes
write successful
readcnt 1 rd_bytes 0
read -1 bytes
readcnt 1 rd_bytes 0
read 1 bytes
readcnt 1 rd_bytes 0
read 1 bytes

serprog: Synchronized
serprog: Interface version ok.
serprog: Bus support: parallel=off, LPC=off, FWH=off, SPI=on
Warning: Automatic command availability check failed for cmd 0x08 - won't execute cmd
Warning: Automatic command availability check failed for cmd 0x11 - won't execute cmd
serprog: Programmer name is "stm32-vserprog"
serprog: Serial buffer size is 65535
serprog: Output drivers enabled
The following protocols are supported: SPI.
Probing for AMIC A25L010, 128 kB: programmer_map_flash_region: mapping A25L010 from 0x00000000fffe0000 to 0x00000000fffe0000
serprog_spi_send_command, writecnt=1, readcnt=3

I would be thankful for any hints.

Thanks in advance

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.