There are 2 possible reasons for most microcontrollers to hang:

  1. The embedded code has a bug due to which, in some situation, it stops working.  
  2. Microcontroller stops working due to some transient on the power line or some I/O lines. Connected relay operations, EMI/EMC or signal noise can introduce power lines transients. Some microcontrollers also have pins that are used for programming and debugging. If these pins are coupled with some kind of noisy signal, it can cause the microcontroller into bootload mode and lead to the MCU hanging. 

When your, usually working, field devices go offline suddenly and never get online without any traceable bug in the embedded or internet connection issues. The device has stopped outputting messages on the debug port. Stopped responding to commands through any interface. And when only way to make things work is a hard reboot. Then one of the culprits to suspect is power transients / electrical noise that is making the MCU hang.

Generally, this is very much dependent on the PCB layout & the Ground Plane. In addition, you should couple power supply lines with local bypass capacitor close to MCU pins. It is also important to create a proper proper isolation distance between the AC and DC sections of circuit.

If you cannot change your PCB design a possible solutions is:

  1. Use external optical isolaters for digital and analog interfaces – Example using a RS232/485 optical isolator for connecting external serial devices 
  2.  External AC to DC converter with power supply reservoir capacitors or a SMPS AC to DC converter.
  3. Separate or isolated digital and power grounds 

Most MCU hanging, provided the embedded code is not the reason, is power line transients. You can read these two good articles to avoid being in this situation: