I'm working on a project with a Tiny25 and having some trouble trying to determine if the most recent reset was from the BOD or POR. Testing the MCUSR register bits and turning on an led has not been working. ie. the led stays dark so bit is not set as expected.
Perhaps I'm not reading and resetting this register soon enough in my code, as I'm reading it after doing normal peripheral inits, like the timers and adc.
Has anyone done this, are there any tricks I'm missing?
How soon after reset do I need to check the MCUSR register for it to be valid?
I also found one has to write zeros to the bits to clear this register, unlike most register where one writes ones to clear it.
The project involves powering a t25 using a solar cell, what i'm finding is, during low light conditions the t25 resets soon after turning on a LED, as the cell does not yet have enough light on it to power the LED and the voltage sags, causing a reset. I'm trying to determine the level of the sag, is it just a BOD reset, or a deep sag POR reset.
Thanks
JC