Controller Freezes

I am using atmega 2560 as main(master) controller and other 5 salve 2 atmega 8 and 3 atmega 328p, there is tw0 device with analogue output connected to main controller atmega 2560 through ads1115 module ,ads converts analogue signal into 16 bit digital data and give it to atmega 2560 via I2C,

also the main controller has serial communication with pc and I2C comm. with salves. and some motors are also connected with controllers.

Now, My issue is that there is one function which reads the data from ads1115 for fix instances and with fix time interval and prints it. for running code for some time lets say 4-5 hour , controller hangs in between that function. and after that no serial communication work. i have to switch of supply to restart the machine.