Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always return a swdStatusFailure on swdInit #5

Open
hpo14 opened this issue Feb 17, 2024 · 12 comments
Open

always return a swdStatusFailure on swdInit #5

hpo14 opened this issue Feb 17, 2024 · 12 comments

Comments

@hpo14
Copy link

hpo14 commented Feb 17, 2024

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 ?

@alias095
Copy link

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

@redor303
Copy link

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

@racerxdl
Copy link
Owner

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.

@hpo14
Copy link
Author

hpo14 commented Apr 19, 2024

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.

@FMode
Copy link

FMode commented Apr 28, 2024

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

@racerxdl
Copy link
Owner

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.

@FMode
Copy link

FMode commented Apr 28, 2024

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
Copy link

FMode commented May 5, 2024

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 !

@Murakhovskyi
Copy link

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?

@FMode
Copy link

FMode commented May 13, 2024

I certainly added my stuff as Pull Request:
#6

@Murakhovskyi
Copy link

@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.

@FMode
Copy link

FMode commented Jul 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants