EmbeddedRelated.com
Forums

How to correctly use brownout interrupt ?

Started by "sgimin.tw" September 27, 2006
Dear sirs,

I want to use the brownout interrupt to store some information into
internal flash before power-off, but I am not sure that the
interrupt actually happens.

My sequence is as follows:

1. Set GPNVM bit0 and Clear bit1 to enable brownout detector.
2. Set BODIEN in reset controller.
3. Configure System interrupt (SYSIRQ) function and enable it.

And the interrupt function should store data into flash region, but
this doesn't happen.

I want to know if the above sequence has any error ? If not, is it
possible that the interrupt has happened but doesn't have enough
time to program flash ?!

Can you give me some suggestion ?!
I will deeply appreciate you !!

Albert
Albert,

I'm not certain which SAM device you are using, but the SAM7S64 data
sheet says that the embedded flash is protected against corruption
during VDDCORE power supply changes. Furthermore, on p. 22 of the
SAM7S64 datasheet, Figure 10-1 shows that the BOD has an output named
"flash_wrdis". There is no explicit statement to this effect, but I
would presume that this means that the Brownout Detector disables
writes to the flash memory. I recommend considering a different
shutdown procedure or a different algorithm for when this data is
stored.

!!Dean

On Sep 27, 2006, at 04:21, sgimin.tw wrote:

> Dear sirs,
>
> I want to use the brownout interrupt to store some information into
> internal flash before power-off, but I am not sure that the
> interrupt actually happens.
>
> My sequence is as follows:
>
> 1. Set GPNVM bit0 and Clear bit1 to enable brownout detector.
> 2. Set BODIEN in reset controller.
> 3. Configure System interrupt (SYSIRQ) function and enable it.
>
> And the interrupt function should store data into flash region, but
> this doesn't happen.
>
> I want to know if the above sequence has any error ? If not, is it
> possible that the interrupt has happened but doesn't have enough
> time to program flash ?!
>
> Can you give me some suggestion ?!
> I will deeply appreciate you !!
>
> Albert
>
I have a solution for you, I use it for some project here.

Use AD7 to sample input voltage trough voltage divisor (two resistor). If your board is powered with 12v, if voltage go under 8 volts (example) you can write what you want before voltage en supply reach critical voltage, power supply big capacitor can give you 0.5 seconds to several second to back-up all your data.

good idea??

Remi Bilodeau - Technicien en ectronique
UQAT - Universitdu Quec en Abitibi-Tiscamingue

________________________________

De : A... [mailto:A...] De la part de Dean Hall
Envoy: 27 septembre 2006 08:37
: A...
Objet : Re: [AT91SAM] How to correctly use brownout interrupt ?

Albert,

I'm not certain which SAM device you are using, but the SAM7S64 data
sheet says that the embedded flash is protected against corruption
during VDDCORE power supply changes. Furthermore, on p. 22 of the
SAM7S64 datasheet, Figure 10-1 shows that the BOD has an output named
"flash_wrdis". There is no explicit statement to this effect, but I
would presume that this means that the Brownout Detector disables
writes to the flash memory. I recommend considering a different
shutdown procedure or a different algorithm for when this data is
stored.

!!Dean

On Sep 27, 2006, at 04:21, sgimin.tw wrote:

> Dear sirs,
>
> I want to use the brownout interrupt to store some information into
> internal flash before power-off, but I am not sure that the
> interrupt actually happens.
>
> My sequence is as follows:
>
> 1. Set GPNVM bit0 and Clear bit1 to enable brownout detector.
> 2. Set BODIEN in reset controller.
> 3. Configure System interrupt (SYSIRQ) function and enable it.
>
> And the interrupt function should store data into flash region, but
> this doesn't happen.
>
> I want to know if the above sequence has any error ? If not, is it
> possible that the interrupt has happened but doesn't have enough
> time to program flash ?!
>
> Can you give me some suggestion ?!
> I will deeply appreciate you !!
>
> Albert
>