Hi Sebastian,
thank you for your reply, but I'm afraid, I can't enter bootloader as it is disabled in FTFA_FOPT (boot options set). Also, my MCU doesn't have JTAG.
I managed to implement basic SWD code in C and load it into another board. As reset of the target board is disabled, I reset it by turning target's power on and off. I have success in reading IDCODE (the target MCU returns 0x0BC11477).
Can you please instruct me how to implement halting MCU or perform mass erase using SWD (exact commands to be sent via SWD needed)? I'm trying reading/writing SW-DP CTRL/STAT and writing SW-DP SELECT register without any success. Is there also any special timing needed? This is what I implemented:
Read DP register 0x00 (IDCODE) - target returns 0x0BC11477
Read DP register 0x04 (CTRL_STAT) - target returns 0x000000C0
Write DP register 0x04 (CTRL_STAT) with value 0x50000000 - the request is acknowledged with 0x4 (FAULT)
Write DP register 0x08 (SELECT) with value 0x01000000 (select MDM-AP, bank 0) - the request is acknowledged with 0x4 (FAULT)