How to check the source of reset in ATMEGA644p

atmegaatmelatmel-studioavrreset

I am trying to find the source of reset for ATMEGA644p, but I couldn't find the way to do it!

MCUCSR gives error in atmel studio as not declared and the datasheet also doesn't have it.

Best Answer

According to the ATMEGA644p datasheet section 9.3.1 page 57 , there is the MCU Status Register MCUSR that provides information on which reset source caused an MCU reset.