stm32f0-pico-dump icon indicating copy to clipboard operation
stm32f0-pico-dump copied to clipboard

always return a swdStatusFailure on swdInit

Open hpo14 opened this issue 1 year ago • 14 comments
trafficstars

I am trying to make a dump from a new stm32f030c6t6 chip with pico under windows and as the title, i got swdStatusFailure(0xE0u or 224 in deciaml) on the very first step (swdInit) of extractFlashData. and im sure my wire connection are all good.

❯ python .\dump.py --port COM8 fw.bin Reading from COM8 to file fw.bin Received ready. Starting dump Received Starting Received Error reading: 224 Received DONE

Get the same error code with below test.

  1. adjust DELAY_JITTER_MS_MIN with different value. (0u, 5u,10u, 20u, 50u)
  2. without any connection to target ic.

anything else i can check ?

hpo14 avatar Feb 17 '24 16:02 hpo14

python .\dump.py --port COM6 fw.bin Reading from COM6 to file fw.bin Received ready. Starting dump Received Starting Received Error reading: 224 Received DONE

Also such a mistake

alias095 avatar Feb 18 '24 08:02 alias095

Yeah same with me. Is this error indicating, that protection level 2 is in place instead of level 1?

redor303 avatar Apr 18 '24 23:04 redor303

Check with a SWD debug cable if you can see the device . The Protection level 2 disables SWD , the protetion level 1 just forbids reading the flash memory.

racerxdl avatar Apr 19 '24 10:04 racerxdl

Check with a SWD debug cable if you can see the device . The Protection level 2 disables SWD , the protetion level 1 just forbids reading the flash memory.

The chip i used was a brand new ic without any protection, and it can be read/write by stink, through SWD interface, but failed with pico dumper.

hpo14 avatar Apr 19 '24 11:04 hpo14

Take a LA like "PulseView" and compare with ST-LINK V2. The JTAG->SWD command after line reset is missing here.

FMode avatar Apr 28 '24 13:04 FMode

Thats intentional. Thats not a generic dumper but one made specifically for dumping the firmware while protected. It skips several steps on SWD line to be able to do that. Thats the only purpose of this project.

racerxdl avatar Apr 28 '24 17:04 racerxdl

This is the only difference I can spot. After LINERESET the JTAG->SWD command, another LINERESET, IDCODE and the target replies "OK". While it never replies when only the LINERESET is sent. Too bad that you can not switch off "JTAG->SWD" command in the ST-LINK utility. https://research.kudelskisecurity.com/2019/05/16/swd-arms-alternative-to-jtag/ https://developer.arm.com/documentation/ddi0413/c/debug-access-port/swj-dp/swd-and-jtag-select-mechanism

edit: no time today Pullup data line and saw communication for the first time static void swdDataIdle(void) { digitalWrite(SWDIO_Pin, HIGH); MWAIT; pinMode(SWDIO_Pin, **INPUT_PULLUP**); MWAIT; } needs more investigation...

FMode avatar Apr 28 '24 20:04 FMode

Finally works with my STM32F091xC soldered in device. My device changes RESET line so it resets itself in regular intervals. I added the JTAG2SWD sequence and I added the "connect at reset" function from ST-LINK utility.

Great stuff @racerxdl !

FMode avatar May 05 '24 16:05 FMode

Finally works with my STM32F091xC soldered in device. My device changes RESET line so it resets itself in regular intervals. I added the JTAG2SWD sequence and I added the "connect at reset" function from ST-LINK utility.

Great stuff @racerxdl !

How can I contact you?

Murakhovskyi avatar May 13 '24 14:05 Murakhovskyi

I certainly added my stuff as Pull Request: https://github.com/racerxdl/stm32f0-pico-dump/pull/6

FMode avatar May 13 '24 14:05 FMode

@racerxdl

Lucas, Good Afternoon.

In order to eliminate any factors that could interfere, I desoldered the chip (STM32F091) and soldered it directly to the LQFP64 legs: 64.VDD - 26 Pin PWR Pico 18.VSS - 28 Pin GND Pico 7.NRST - 27 Pin RESET Pico 46.PA13(SWDIO) - 14 Pin SWDIO Pico 49.PA14(SWCLK) - 15 Pin SWCLK Pico

But I have error 244 (E0), in your version. I need this whole idea to resurrect the device whose M burned out.

Tell me what I'm doing wrong. I'll be very grateful.

Murakhovskyi avatar May 14 '24 13:05 Murakhovskyi

Sorry after a lot of tries I can now communicate nearly stable via SWD. I always get SWDFault as reply to the read request no matter what I try - also with a STM32F03 dev board just locked. STM has never replied to this and I guess here is nothing to reply because that is just a hoax or only works under very few and random circumstances. I was able to readout excactly 1 STM32F09 on a "real" PCB but it never worked again.

FMode avatar Jul 09 '24 13:07 FMode