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.
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