ACMP (comparator) as wake-up from low-power

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

ACMP (comparator) as wake-up from low-power

1,482 Views
boblees
Contributor I

I am using the comparator (ACMP) as wake-up source for LPC55[S]0x. The threshold voltage is set to 100mV.  When the device is powered up the comparator works as expected, i.e. the comparator output goes positive when the input voltage exceeds the threshold voltage.  When in low power mode a 20 uSec pulse is applied which is only detected, i.e. the processor wakes up, when the pulse is over 1 volt.  This is way in excess of the threshold of 100mV.  The input is applied to ACMP_A.

This occurs both with the VREF being VDDA using the internal voltage ladder and applying an external reference to ACMP_B.

How do I configure the comparator to wake-up the processor when the 20 uSec pulse just exceeds the set threshold rather than having to be way in excess of the threshold.

Labels (3)
0 Kudos
Reply
4 Replies

1,469 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello boblees,

It seems the 20us is too short, what's the result when you test it on your project, or use the ACMP demo under SDK to test.

0 Kudos
Reply

1,465 Views
boblees
Contributor I

Hi Alice

When I test on my project it takes at least 1 volt over the threshold to wake up from power down mode with a 20 uSec pulse.  When powered up the comparator works as expected.

Which ACMP example are you referring to?  Is there one which shows ACMP waking from power down?

For your information here is the code which sets up the comparator and the power down call.

cmp_config_t PMC_config = {
.enableHysteresis = false,
.enableLowPower = false,  // doesn't make any difference if this is true or false
.filterClockDivider = kCMP_FilterClockDivide1,
.filterSampleMode = kCMP_FilterSampleMode0
};
/* Configuration of the DAC sub-module, used in the CMP_SetVREF() function */
cmp_vref_config_t PMC_dac_config = {
.vrefSource = KCMP_VREFSourceVDDA,
.vrefValue = 1U
};

void PMC_init() {
/* Initialize CMP main sub-module functionality */
CMP_Init(&PMC_config);
/* CMP output signal path initialization */
CMP_EnableFilteredInterruptSource(false);
/* Set up internal DAC sub-module, that can be used as input 0 of the CMP both inputs. */
CMP_SetVREF(&PMC_dac_config);
/* Initialize CMP main sub-module functionality */
CMP_SetInputChannels(kCMP_Input1, kCMP_InputVREF);
}

POWER_DisablePD(kPDRUNCFG_PD_COMP);
EnableIRQ(ACMP_IRQn);
CMP_EnableInterrupt(kCMP_EdgeFalling);
POWER_EnterPowerDown(kPDRUNCFG_PD_FRO32K | kPDRUNCFG_PD_COMP,
0x40DF, 
WAKEUP_ACMP | WAKEUP_GPIO_GLOBALINT0 | WAKEUP_GPIO_GLOBALINT1,
LOWPOWER_CPURETCTRL_ENA_ENABLE);
0 Kudos
Reply

1,457 Views
boblees
Contributor I

Hi again Alice

Having re-read UM11424 many times, especially section 14, I finally tried adding (1UL << 1) (BIAS) to the exclude_from_pd parameter and the wake-up now works as expected. i.e. > comparator reference (100mV) with 20uS pulse and the device wakes up.  The missing magic appears to be that analogue bias needs to remain powered up.  This is less than clear in UM11424 in the examples and is totally missing from fsl_power.h in 

/**
* @brief Analog components power modes control during low power modes
*/
typedef enum pd_bits
{
kPDRUNCFG_PD_BODCORE = (1UL << 2),
kPDRUNCFG_PD_BODVBAT = (1UL << 3),
kPDRUNCFG_PD_FRO1M = (1UL << 4),
kPDRUNCFG_PD_FRO192M = (1UL << 5),
kPDRUNCFG_PD_FRO32K = (1UL << 6),
kPDRUNCFG_PD_XTAL32K = (1UL << 7),
kPDRUNCFG_PD_XTAL32M = (1UL << 8),
kPDRUNCFG_PD_PLL0 = (1UL << 9),
kPDRUNCFG_PD_PLL1 = (1UL << 10),
kPDRUNCFG_PD_COMP = (1UL << 13),
kPDRUNCFG_PD_GPADC = (1UL << 15),
kPDRUNCFG_PD_LDOGPADC = (1UL << 19),
kPDRUNCFG_PD_LDOXO32M = (1UL << 20),
kPDRUNCFG_PD_LDOFLASHNV = (1UL << 21),
kPDRUNCFG_PD_RNG = (1UL << 22),
kPDRUNCFG_PD_PLL0_SSCG = (1UL << 23),
/*
This enum member has no practical meaning,it is used to avoid MISRA issue,
user should not trying to use it.
*/
kPDRUNCFG_ForceUnsigned = 0x80000000U,
} pd_bit_t;

as you can see kPDRUNCFG_PD_BIAS is not defined which clearly it should be.  This is with MCUXpresso 11.3.1. I know 11.4 has just been released and I haven't installed it yet to determine if this still exists as an omission.

So my exclude_from_pd = kPDRUNCFG_PD_COMP | (1UL << 1)

Can you please confirm that my solution is correct?

Bob

0 Kudos
Reply

1,434 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello boblees,

Thanks for your sharing, yes, your solution is correct.

You can see in UM,Page 303:

The analog references (BIAS) are required only when the analog comparator is a wake-up
source.

 

BR

Alice

0 Kudos
Reply