Brownout detect and flash quick write.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Brownout detect and flash quick write.

471 Views
Pranavmv012
Contributor I

Hello, 

I am trying to do a quick write to flash ( 1-10 bytes ) of data to internal flash(eeprom) of LPC1758 when the brownout is detected. The normal writing to flash function doesn't work from the ISR, when the ISR is triggerred the supply voltage is 2.3v. ( with this supply voltage, writing to the flash works with other functions such as main(), but doesn't work from any ISR(tried ADCIrqHandler as well). Is it possible to write few bytes to flash if the brownout is detected. If yes, could you please provide the example program of a quick write to eeprom on LPC1758. 

Thanks and Regards. 

@miguelrc 

Labels (1)
Tags (1)
0 Kudos
1 Reply

459 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I see your scenario that you use ADC to sample power supply voltage, when the power supply voltage is 2.3V or below, you write a few data to on-chip flash of LPC1758 by calling IAP function. But you found out you had issue to write flash by calling IAP function in ISR of ADC.

I suggest you you set a flag only when the Brownout happens in the ADCIrqHandler(), instead in the main() function, you poll the flag, and write flash in main().

For example, assume that you have set the bool BrownoutFlag flag in the ADCIrqHandler() when brownout happens.

void main()

{

..........

while()

{

if(BrownoutFlag)

{

disable all interrupt

erase page

program page

clear flag BrownoutFlag

enable all interrupt

}

}

}

Pls have a try

BR

XiangJun Rong

0 Kudos