Running code on nrf52840-DK fails after flashing without bootloader

You are just 'shotgunning'. You need to use correct terminology, and you need to have at least a basic understanding of what you want to do. Given your random messing with pins, toss those boards in the bin unless you can upload a test sketch to prove they are ok.