Hello,
With OSBDM, the MCU enters Special Single Chip Mode. See Chapter 1.9.1 of the reference manual.
Without the debugger, the MCU enters Normal Single Chip Mode.
Certain registers can be written only once in Normal Mode, for instance MODRR0/1,2, FOPT, CPMUCOP, …
Whereas in Special Mode, they can be written anytime.
So make sure all the registers are written only once.
Regards,
Daniel