<?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>topic Re: No ADC interrupt after deep sleep on LPC845 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/No-ADC-interrupt-after-deep-sleep-on-LPC845/m-p/999807#M39276</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&amp;nbsp;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="311285" data-username="davidingleby-oddy" href="https://community.nxp.com/people/davidingleby-oddy" style="color: #3d9ce7; background-color: #ffffff; border: 0px; font-weight: 600; text-decoration: none; font-size: 11.9994px;"&gt;David Ingleby-Oddy&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;SPAN&gt;How about reset&amp;nbsp; the ADC module after wake up, refer to the reset function under SDK:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;static void RESET_SetPeripheralReset(reset_ip_name_t peripheral)&lt;BR /&gt;{&lt;BR /&gt; const uint32_t regIndex = ((uint32_t)peripheral &amp;amp; 0xFFFF0000u) &amp;gt;&amp;gt; 16;&lt;BR /&gt; const uint32_t bitPos = ((uint32_t)peripheral &amp;amp; 0x0000FFFFu);&lt;BR /&gt; const uint32_t bitMask = 1u &amp;lt;&amp;lt; bitPos;&lt;/P&gt;&lt;P&gt;assert(bitPos &amp;lt; 32u);&lt;/P&gt;&lt;P&gt;/* reset register is in SYSCON */&lt;/P&gt;&lt;P&gt;if (0u == regIndex)&lt;BR /&gt; {&lt;BR /&gt; /* set bit */&lt;BR /&gt; SYSCON-&amp;gt;PRESETCTRL0 &amp;amp;= ~bitMask;&lt;BR /&gt; }&lt;BR /&gt; if (1u == regIndex)&lt;BR /&gt; {&lt;BR /&gt; /* set bit */&lt;BR /&gt; SYSCON-&amp;gt;PRESETCTRL1 &amp;amp;= ~bitMask;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If still can't work, there is low power and ADC demo under SDK, you can have a look.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Nov 2019 07:38:22 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2019-11-06T07:38:22Z</dc:date>
    <item>
      <title>No ADC interrupt after deep sleep on LPC845</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/No-ADC-interrupt-after-deep-sleep-on-LPC845/m-p/999806#M39275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;We have an LPC845 application that uses the internal&amp;nbsp; ADC and this is working without a problem until we enter and exit deep sleep mode, whereupon no further ADC interrupts are generated.&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;The following code is used to enter deep sleep with a WKT interrupt waking the device after a variable period of time:&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;void sleep(uint32_t timeout)&lt;BR /&gt;{&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Setup the WKT timer and configure power down control&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_ADC);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_GPIO0);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_GPIO1);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_GPIOINT);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_IOCON);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_SWM);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_WKT);&lt;BR /&gt; Chip_PMU_SetPowerDownControl(LPC_PMU, PMU_DPDCTRL_LPOSCEN | PMU_DPDCTRL_LPOSCDPDEN | PMU_DPDCTRL_WAKEUPPAD | PMU_DPDCTRL_WAKEUPPAD2);&lt;BR /&gt; Chip_SYSCON_PeriphReset(RESET_WKT);&lt;BR /&gt; Chip_SYSCON_EnablePeriphWakeup(SYSCON_STARTER_WKT);&lt;BR /&gt; NVIC_EnableIRQ(WKT_IRQn);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Record current peripheral power status ready for wakeup&lt;BR /&gt; // and configure power down configuration&lt;BR /&gt; LPC_SYSCON-&amp;gt;PDAWAKECFG = LPC_SYSCON-&amp;gt;PDRUNCFG;&lt;BR /&gt; Chip_SYSCON_SetDeepSleepPD((1&amp;lt;&amp;lt;SYSCON_PDRUNCFG_BOD) | (1&amp;lt;&amp;lt;SYSCON_PDRUNCFG_WDTOSC));&lt;BR /&gt; Chip_SYSCON_DisableBODReset();&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Turn all LEDs off&lt;BR /&gt; Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, GPIO_LED_RED, pinHigh);&lt;BR /&gt; Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, GPIO_LED_GREEN, pinHigh);&lt;BR /&gt; Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, GPIO_LED_BLUE, pinHigh);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Turn off peripheral clocks to save power&lt;BR /&gt; Chip_Clock_DisablePeriphClock(SYSCON_CLOCK_ADC);&lt;BR /&gt; Chip_Clock_DisablePeriphClock(SYSCON_CLOCK_UART0);&lt;BR /&gt; Chip_Clock_DisablePeriphClock(SYSCON_CLOCK_UART1);&lt;BR /&gt; Chip_Clock_DisablePeriphClock(SYSCON_CLOCK_UART2);&lt;BR /&gt; Chip_Clock_DisablePeriphClock(SYSCON_CLOCK_IOCON);&lt;BR /&gt; Chip_Clock_DisablePeriphClock(SYSCON_CLOCK_SWM);&lt;BR /&gt; Chip_Clock_DisablePeriphClock(SYSCON_CLOCK_GPIO0);&lt;BR /&gt; Chip_Clock_DisablePeriphClock(SYSCON_CLOCK_GPIO1);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Set the WKT to timeout * 10&lt;BR /&gt; Chip_WKT_Start(LPC_WKT, WKT_CLKSRC_10KHZ, timeout * 10);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Enter sleep awaiting WKT interrupt&lt;BR /&gt; Chip_PMU_Sleep(LPC_PMU, PMU_MCU_POWER_DOWN);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Stop the WKT on wakeup&lt;BR /&gt; Chip_WKT_Stop(LPC_WKT);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Jumps the system timer forward by the sleep period&lt;BR /&gt; Platform_jumpTick(timeout);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Re-initialise ADC&lt;BR /&gt; adc_init();&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;}&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;and this is the IRQ handler which&amp;nbsp;re-enables&amp;nbsp;the peripheral clocks upon WKT interrupt:&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;void WKT_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt; Chip_WKT_ClearIntStatus(LPC_WKT);&lt;BR /&gt; SCB-&amp;gt;SCR &amp;amp;= ~(1&amp;lt;&amp;lt;2);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_ADC);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_UART0);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_UART1);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_UART2);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_GPIO0);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_GPIO1);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;}&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;The application also uses three UARTs and a number of other peripherals which work after deep sleep exit so its only the ADC that is the problem.&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;To ensure that the ADC is re-initialised and re-calibrated after deep sleep we also call adc_init() again after exit:&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;void adc_init(void)&lt;BR /&gt;{&lt;BR /&gt; // Setup ADC for 12-bit mode and normal power&lt;BR /&gt; Chip_ADC_Init(LPC_ADC, 0);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Enable clock, and divide-by-1 at this clock divider&lt;BR /&gt; LPC_SYSCON-&amp;gt;ADCCLKDIV = 1;&lt;BR /&gt; LPC_SYSCON-&amp;gt;ADCCLKSEL = 0;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Calibrate ADC&lt;BR /&gt; Chip_ADC_StartCalibration(LPC_ADC);&lt;BR /&gt; while (!(Chip_ADC_IsCalibrationDone(LPC_ADC))) {}&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Setup for maximum ADC clock rate using synchronous clocking&lt;BR /&gt; Chip_ADC_SetClockRate(LPC_ADC, 10000000);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Setup a sequencer to read from ADC0&lt;BR /&gt; Chip_ADC_SetupSequencer(LPC_ADC, ADC_SEQA_IDX, (ADC_SEQ_CTRL_CHANSEL(0) | ADC_SEQ_CTRL_MODE_EOS));&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Enable the clock to the Switch Matrix before assigning pins&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_SWM);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Configure the SWM for P0_7 as the input for the ADC0&lt;BR /&gt; Chip_SWM_FixedPinEnable(SWM_FIXED_ADC_0, 1);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Disable the clock to the Switch Matrix to save power&lt;BR /&gt; Chip_Clock_DisablePeriphClock(SYSCON_CLOCK_SWM);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Clear all pending interrupts&lt;BR /&gt; Chip_ADC_ClearFlags(LPC_ADC, Chip_ADC_GetFlags(LPC_ADC));&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Enable ADC overrun and sequence A completion interrupts&lt;BR /&gt; Chip_ADC_EnableInt(LPC_ADC, (ADC_INTEN_SEQA_ENABLE | ADC_INTEN_OVRRUN_ENABLE));&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Enable ADC NVIC interrupt&lt;BR /&gt; NVIC_EnableIRQ(ADC_SEQA_IRQn);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Enable sequencer&lt;BR /&gt; Chip_ADC_EnableSequencer(LPC_ADC, ADC_SEQA_IDX);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;// Manual start for ADC conversion sequence A&lt;BR /&gt; Chip_ADC_StartSequencer(LPC_ADC, ADC_SEQA_IDX);&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;}&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;We have checked all the PDRUNCFG, NVIC and&amp;nbsp;SYSAHBCLK0CTRL registers after exit and these all indicate that the ADC is functional but we do not get any further ADC interrupts until we hard reset the device.&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;Any help would be very much appreciated.&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Nov 2019 15:15:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/No-ADC-interrupt-after-deep-sleep-on-LPC845/m-p/999806#M39275</guid>
      <dc:creator>davidingleby-od</dc:creator>
      <dc:date>2019-11-04T15:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: No ADC interrupt after deep sleep on LPC845</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/No-ADC-interrupt-after-deep-sleep-on-LPC845/m-p/999807#M39276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&amp;nbsp;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="311285" data-username="davidingleby-oddy" href="https://community.nxp.com/people/davidingleby-oddy" style="color: #3d9ce7; background-color: #ffffff; border: 0px; font-weight: 600; text-decoration: none; font-size: 11.9994px;"&gt;David Ingleby-Oddy&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;SPAN&gt;How about reset&amp;nbsp; the ADC module after wake up, refer to the reset function under SDK:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;static void RESET_SetPeripheralReset(reset_ip_name_t peripheral)&lt;BR /&gt;{&lt;BR /&gt; const uint32_t regIndex = ((uint32_t)peripheral &amp;amp; 0xFFFF0000u) &amp;gt;&amp;gt; 16;&lt;BR /&gt; const uint32_t bitPos = ((uint32_t)peripheral &amp;amp; 0x0000FFFFu);&lt;BR /&gt; const uint32_t bitMask = 1u &amp;lt;&amp;lt; bitPos;&lt;/P&gt;&lt;P&gt;assert(bitPos &amp;lt; 32u);&lt;/P&gt;&lt;P&gt;/* reset register is in SYSCON */&lt;/P&gt;&lt;P&gt;if (0u == regIndex)&lt;BR /&gt; {&lt;BR /&gt; /* set bit */&lt;BR /&gt; SYSCON-&amp;gt;PRESETCTRL0 &amp;amp;= ~bitMask;&lt;BR /&gt; }&lt;BR /&gt; if (1u == regIndex)&lt;BR /&gt; {&lt;BR /&gt; /* set bit */&lt;BR /&gt; SYSCON-&amp;gt;PRESETCTRL1 &amp;amp;= ~bitMask;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If still can't work, there is low power and ADC demo under SDK, you can have a look.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Nov 2019 07:38:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/No-ADC-interrupt-after-deep-sleep-on-LPC845/m-p/999807#M39276</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2019-11-06T07:38:22Z</dc:date>
    </item>
  </channel>
</rss>

