I have two Rak4631 modules. One is the WisBlock Starter Kit and the other is on a pcb. Rak4631 module on the pcb, I can only program from the SWDIO port. Because the USB port connection of the module is not made on the PCB. There is only SWDIO output for programming. I use Segger J-link V9 for this.
My question is:
I wrote a program in Arduino IDE and I send it directly to the Starter Kit via USB and it connects to TheThingsNetwork immediately. I send the same program in Hex format with J-link to Rak4631 on the pcb, but it does not connect to TTN.
The module on the PCB previously had a Hello World program. I’ve backed it up before. To check the stability of the module, I am sending that HEX File back to the module via J-link. This time it connects to TTN without any problem and sends Hello World.
The hex file that Arduino produces is only the application, it does not include the bootloader and the softdevice of the nRF52. If you erased the chip and then flash the hex file, the nRF52 will not boot because the bootloader is missing
If your code is waiting for USB with
while (!Serial){};
it will not continue to finish the setup() ever, because Serial USB will never be available.