PCA10040 dk flash entire erase after linked to jlink

I'm developing with PCA10040 DK(3.0.0 2022.10), the IDE is SES for ARM 5.42a.

The app is normal after download the application. After a reset or power off and restart, the program works fine. Once I connect the PCA10040 DK with the J-Link on board to J-Flash or J-Link RTT Viewer, the application is erased.

I found this problem by J-flash. Entire flash is erased to 0xFF. I get this problem whether I use the examples in the SDK or my own program on PCA10040. 

But when I use my own PCB and external J-Link, there is not any problem. I can connect to RTT viewer to check logs any time. The flash is normal.

I'm sure I didn't enable read protection.

Related