I have been working on a project where we use Atmega328 and Sim900A chips to transmit some data over GPRS. The first prototype is working since 4 months while second prototype is working since more than a month. Our code has evolved quite a bit through this time.
The next set of boards we have made uses same PCBs as prototype 2 and same set components except for two components (but almost identical specs) in power supply of sim900. This set of boards was built after successful operation of prototype 2 for couple of weeks. Even though the latest set has practically same h/w and s/w, the boards are suffering very weird problem. The atmega328 gets hanged during operation and stops working.
I am struggling since more than a week to find the reason for the problem but have not had any success so far. Any help/suggestion will be highly appreciated. Following are relevant points
-The circuit is supposed to work 24x7. It is found to hang at various times like right at the start-up, few minutes after start-up, or few hours after start-up. I tried to get exact point where it hangs through serial log, however there isn't any particular point at which it hangs. -The boards have atmega328pu in place of atmega328p. I have always burned arduino bootloader before uploading code via USBASP. The sketch takes up 93% of available flash space -The fuse bits are set to same values as they are while burning bootloader from Arduino IDE. I even verified this by reading fuse bits from one chip. -Global variables take 79% of dynamic memory. However local variables are kept to minimum. I observed free space in stack at various points as per this and found that at least 275 bytes were always free. Hence I ruled out stack overflow possibility -The circuit has onboard SMPS. Atmega works on 5V while Sim900 is working on 4.3V. I checked supply voltage to Atmega328 as well as Sim900 on oscilloscope. The voltage variation was less than 100mV. -The reset pin has been pulled up, so no possibility of noise there. However the Rx and Tx remain open. -As the code has evolved over a long time with previous version working well for more than a month, I don't suspect coding bugs like infinite loops causing this problem. Still it has been thoroughly checked for such possibilities. -Watch dog timer has not been used. Its a possible workaround but I would ideally like to find reason why the board hangs in first place.
After checking all the possibilities I can think of, I still don't have any clue about reasons behind this weird problem ::) :( . A sincere request to post any suggestion you may have.
Thanks in advance.