I'm really impressed by how low power consume on this thread
However, I tried to apply the code to my bare Atmega644P, the lowest I could get is 1mA which is too much to compare with ATmega328P.
Running with 3.3V 16Mhz running on SLEEP_MODE_PWR_DOWN
Could you please help me to point out what is the difference between 2 of them?
I compared the datasheet and it looks similar the sleep part.
Does the current drop when you turn off the ADC, what was it before turning off the ADC?
This seems like the problem area. Could the reference be damaged? is AREF bypassed with .1uF and nothing else connected to it?
BDO sleep. Well, that is JFM so I can't help.
On a 1284p I have used the blank (factory default) had about 3mA with 5V, internal oscillator at 1MHz, ADC reference on, pins floating. When I set it to run a 16MHz crystal with full swing fuse setting, ADC ref on, and most pins floating I recall that it used about 18mA. I got different readings with floating pins from one microcontroller to the next, but that is expected.
Does the current drop when you turn off the ADC, what was it before turning off the ADC?
This seems like the problem area. Could the reference be damaged? is AREF bypassed with .1uF and nothing else connected to it?
BDO sleep. Well, that is JFM so I can't help.
On a 1284p I have used the blank (factory default) had about 3mA with 5V, internal oscillator at 1MHz, ADC reference on, pins floating. When I set it to run a 16MHz crystal with full swing fuse setting, ADC ref on, and most pins floating I recall that it used about 18mA. I got different readings with floating pins from one microcontroller to the next, but that is expected.
Thanks.
Yes. All pin set to output and LOW
Yes. It drops when turn off the ADC from 3mA to ~1.5mA but no change when turn off BDO.
Yep, something is wrong when you turn off the ADC.
Two things I can think of. The first is that optiboot does not disable the UART after it is done trying to detect avrdude it just passes control to the user program. Second, the TWI (or I2C) pins have a weak pull up if that was enabled.
I would try Hans (MCUdude) repositories.
MightyCore turns off the UART (like the default Uno core), but I did not look in the core you are using (it probably does but you should check).