Hi Wojciech Lesniewicz,
What the board you are using? Official board or your own designed board?
If it is the own designed board, please check the external circuit:
1. Reset_b pin should have external 4.7K to 10K pull up resistor, and 0.1uf capacitor to ground.
2. NMI pin should add external 4.7K to 10K pull up resistor.
You said, your board get stuck every time, did you debug it? where it will be stuck? You can upload a debug picture.
When you use the Segger debugger, you can use the JLINK commander window to check your board, whether it can find the core or not?
Wish it helps you!
If you still have problem, please contact me!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------