SWD stopped working after write to core registers

Hi. I have a task - make a simple implementaton of SWD protocol, that will be used to program one STM32F4 throught another one. For that purpose, host STM uses pins of PORTD, target is connected with PA13 and PA14.

I have successfully read IDCODE and IDR values, enabled AHB-AP, and next step was halting the core. I followed that guide: https://www.cnblogs.com/shangdawei/p/4753040.html

1) Wrote 0xA05F0003u to DHCSR

2) Wrote 0x00000001u to DEMCR

3) Wrote 0xFA050004u to AIRCR

After that, SWD stopped working, every request except IDCODE reading returns 111, which means that target is disconnected. Even after power disable, situation has not changed. Only request i can do is read IDCODE.

What i have done wrong?

More questions in this forum