I am performing tests with the circuit diagram shown in the attachment.
D4 is used as a PWM output.
A7 is used to measure the voltage at the drain of the MOSFET.
The MOSFET is used as a high side switch charging the accu via R2.
When the USB connection is removed but the external 5V supply still is connected the LEDs on the Nano are lighting up.
When the connection to A7 is removed the LEDs are off.
The accu seems to power the Nano via R2.
The Atmel description of Atmega328 does not give me enough details to understand how the analog input can power the controller.
Usually in my tests, at first I am switching off the external 5V and then disconnect USB. But there are many tests, and sometimes I forget to switch off external 5V.
Up to now the controller survived and still is working.
But can it be dangerous for the controller chip when it is powered via A7?
In a future circuit not only the charging circuit but also the Nano shall be powered via external 5V using the pin “+5V” on the Nano. From the schematic of the Nano this should be no problem.
Is this really ok?