I am using nRF52840 board. And I used keil and nrfjprog, both successfully flashed the hex file onto the board with USB connected. The example I used is ble_app_uart_c.
My program runs fine, but once I disconnected the USB cable and use the battery. The board does not work. I have changed the battery. I have tried and encounter this problem on several nRF52840 boards. I have put the power switch on VDD instead of USB when using a battery.
I even used a power profiler and the board lights up the led on power profiler which means the voltage on pin is right. BUT the program does not run. Or it runs for a very short time and died.