<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC MicrocontrollersのトピックRe: Brownout detect and flash quick write.</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Brownout-detect-and-flash-quick-write/m-p/1592723#M51513</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;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().&lt;/P&gt;
&lt;P&gt;For example, assume that you have set the bool BrownoutFlag flag in the ADCIrqHandler() when brownout happens.&lt;/P&gt;
&lt;P&gt;void main()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;..........&lt;/P&gt;
&lt;P&gt;while()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;if(BrownoutFlag)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;disable all interrupt&lt;/P&gt;
&lt;P&gt;erase page&lt;/P&gt;
&lt;P&gt;program page&lt;/P&gt;
&lt;P&gt;clear flag BrownoutFlag&lt;/P&gt;
&lt;P&gt;enable all interrupt&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;Pls have a try&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
    <pubDate>Fri, 03 Feb 2023 02:12:10 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2023-02-03T02:12:10Z</dc:date>
    <item>
      <title>Brownout detect and flash quick write.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Brownout-detect-and-flash-quick-write/m-p/1592399#M51508</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and Regards.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/91560"&gt;@miguelrc&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 18:49:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Brownout-detect-and-flash-quick-write/m-p/1592399#M51508</guid>
      <dc:creator>Pranavmv012</dc:creator>
      <dc:date>2023-02-02T18:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Brownout detect and flash quick write.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Brownout-detect-and-flash-quick-write/m-p/1592723#M51513</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;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().&lt;/P&gt;
&lt;P&gt;For example, assume that you have set the bool BrownoutFlag flag in the ADCIrqHandler() when brownout happens.&lt;/P&gt;
&lt;P&gt;void main()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;..........&lt;/P&gt;
&lt;P&gt;while()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;if(BrownoutFlag)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;disable all interrupt&lt;/P&gt;
&lt;P&gt;erase page&lt;/P&gt;
&lt;P&gt;program page&lt;/P&gt;
&lt;P&gt;clear flag BrownoutFlag&lt;/P&gt;
&lt;P&gt;enable all interrupt&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;Pls have a try&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 02:12:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Brownout-detect-and-flash-quick-write/m-p/1592723#M51513</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2023-02-03T02:12:10Z</dc:date>
    </item>
  </channel>
</rss>

