Maker Pro
Maker Pro

Brown out detection for Arduino mega 2560

Jeroen Humasol

Nov 8, 2015
68
Joined
Nov 8, 2015
Messages
68
Hi everyone,

I read in the datasheet that the arduino mega has a brown out detection. (datasheet: http://www.atmel.com/images/atmel-2...r-atmega640-1280-1281-2560-2561_datasheet.pdf)

But i was wondering, can i also use the brown out to trigger an interrupt? What i would like to do is just safe 1 variable to eeprom before the arduino dies. So it would call an interrupt routine that just stores this variable.

Anyone knows if this is possible?

Thanks!
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,615
Joined
Nov 17, 2011
Messages
12,615
According to chapters 8.3.2 and 12.2.3 the built-in brown out detector, when enabled, activates RESET, not an interrupt.
You could supervise Vcc externally and issue an interrupt. Set the threshold of the external supervising circuit higher than the level of the internal brown out detector. Provide enough bufffer capacity to allow the AVR to do some useful stuff when triggered by the external interrupt before the internal brown out detector is triggered by the falling voltage on Vcc.
 

Jeroen Humasol

Nov 8, 2015
68
Joined
Nov 8, 2015
Messages
68
According to chapters 8.3.2 and 12.2.3 the built-in brown out detector, when enabled, activates RESET, not an interrupt.
You could supervise Vcc externally and issue an interrupt. Set the threshold of the external supervising circuit higher than the level of the internal brown out detector. Provide enough bufffer capacity to allow the AVR to do some useful stuff when triggered by the external interrupt before the internal brown out detector is triggered by the falling voltage on Vcc.

Hi Harald,

Thanks for the reply! I guess i could do this but it's probably a bit to complex i was hoping on a simple line of code but it seems that that ain't possible.

Thanks for your help
 
Top