dword1511 / stm32-vserprog

flashrom serprog programmer based on STM32 MCU & USB CDC protocol. Uses libopencm3 and deprecates the old serprog-stm32vcp project.
GNU General Public License v3.0
309 stars 91 forks source link

Add XTW100 support #47

Closed swiftgeek closed 4 years ago

swiftgeek commented 4 years ago

Board pictures and PDF

XTW100-25xx-programmer

Would it be better to create xtw100.c and place all the hooks there with vserprog.c having weak functions? Or is current version enough for vserprog?

In any case it works reliably, was testing it for past week (read/write/erase)

Used make BOARD=xtw100 flash-stlink with success to flash stm32f103

Personally I would not recommend this dongle, because it powers target chip/board through GPIO, which can easily end badly for the stm32f103

Tested mostly with W25Q128FVSIG, MX25L25635F

mytbk commented 4 years ago

Good job! This is the working patch for XTW100. I've tested on some off-board flash chips and in-system programming on some boards.

Droid-MAX commented 4 years ago

how to flash hex file into mcu? need short any pins? Found swd upgrade pins, thx!

Droid-MAX commented 4 years ago

Does it can flash i2c eeprom chip?

lss4 commented 3 years ago

Just got myself a XTW100, but the new one has 5 ISP pins instead of 4. The pins are labeled as (from the one closest to the lever) N, E, T, R, G.

EDIT: I'm able to find some hints. However, I still need to dig deeper to figure out what I need to get this one working, or look for the variant that can already do SWD...

lss4 commented 3 years ago

Say does st-flash still work on this? Recently I acquired another board that has SWD pins, but when I try flashing with st-flash (using a ST-Link v2) I got a "Flash loader run error", although erase/mass erase works.

Googling about that error returns a good amount of issues regarding it (such as this and this). With the latest st-flash built from git master it mentioned some details about the error (R2 0x00000000 R15 0x00000000 DHCSR 0x01010001 DFSR 0x00000001)

It seems the MCU on this board is a bit different as with earlier st-flash versions it complained about not knowing what to do due to coreid: 2ba01477, chipid: 410 which was mentioned in this issue.

Will keep investigating. Maybe I should look for a way to upgrade the ST-Link itself as I don't know which firmware version it's on yet...

swiftgeek commented 3 years ago

You need to do mass erase/unprotect mcu first, st-flash often behaves strangely when protection is enabled

I guess maybe openocd can do it with stm32f1x unlock https://stackoverflow.com/questions/32509747/stm32-read-out-protection-via-openocd

lss4 commented 3 years ago

Yeah, it's indeed protected. I ended up hooking it on a Windows machine and disabled it using the official ST-Link utility. After disabling the protection I'm able to properly flash it. It's working now.