I'm controlling 8 N-channel MOSFETS with the following circuit diagram. I have 8 of them connected to IO pins 20 - 27 and all works fine apart from overheating the microcontroller.
When I set the following pins to OUTPUT and turn them HIGH or LOW, the more I set, the hotter the ATmega 2560 gets. When all 8 are set the microcontroller overheats and then malfunctions. What can be causing this issue and is there a way to fix it?
This happens when it is connected via USB without any external power supply and also with a power supply and also with a LOAD to the MOSFET and without a LOAD.