S12ZVL32 ADC Problem In Sleep Mode

cancel
Showing results for 
Search instead for 
Did you mean: 

S12ZVL32 ADC Problem In Sleep Mode

1,341 Views
chaitanya_kalyani
Contributor III

Hello,

Currently, we are using one analog pin for reading multiple switches. Everything is working fine in active mode but when it goes into sleep mode getting current consumption as 240uA and when the switch is pressed current consumption is increasing up to 1mA. 

I need sleep mode current less than 200uA.

Using the below function to put the controller into sleep mode.

void GoToSleep(void)
{
DisableInterrupts;
__asm(andcc #0x6f); // CCW settings: S = 0, I = 0
SCI0ASR1_RXEDGIF = 1; // clear flag
SCI0ACR1_RXEDGIE = 1; // edge interrupt enabled for wake up
EnableInterrupts;
__asm(STOP);
}

I checked with e8188: ADC: High current in Stop Mode code. It is also not working to completely disable the ADC.

using the above type of network.

Suggest some way to disable the analog pin current consumption in sleep mode and reduce current consumption in sleep mode.

Working on an urgent project so quick response is highly appreciated.

Labels (1)
Tags (1)
7 Replies

960 Views
mmiki
Contributor I

STOP mode example where stop current is lower than 30uA and can wake up by LIN:

(workaround is from errata: ERR008188: ADC: High current in Stop Mode, https://www.nxp.com/docs/en/errata/MSE9S12ZVL_0N22G.pdf)

SCI0CR1_WAKE = 1; /* Wake up SCI at an idle condition on the RXD pin */
SCI0SR2_AMAP = 1; /* Make SCIAxxx registers accessible */
SCI0ACR1_RXEDGIE = 1; /* Edge interrupt enabled for wake up */
SCI0ASR1_RXEDGIF = 1; /* Clear flag */
SCI0SR2_AMAP = 0; /* Make SCIAxxx registers inaccessible */
SCI0CR2_RWU = 0x01; /* SCI enters into standby state */


// Enter STOP mode
__DI();
ADC0_stop_current_workaround(); // Subroutine must be executed with interrupt protection
asm(andcc #0x6f); /* CCW settings: S = 0, I = 0 */
asm(stop); /* MCU enters Stop mode if S =0 in CCW */
...
}

static void ADC0_stop_current_workaround(void)
{
byte tmp_ADCxCTL_0 = ADC0CTL_0; // Save customer settings, these values will be restoredafterwards
byte tmp_ADCxTIM = ADC0TIM;
byte tmp_ADCxSTS = ADC0STS;
ADC0CTL_0 =0x00; //Disable ADC
ADC0TIM = 0x00; // ADC is set to maximum frequency
// Devicespecification of allowed frequency is ignored, // the ADC conversion is stopped when reachingMask Set Errata for Mask 0N22G / 0P80C,
// Rev. March 1120214NXP Semiconductors error state.
// There is no conversion result generated.
ADC0CTL_0 = 0x88; // ADC is enabled,single access mode data bus, restart mode
ADC0CTL_0 = 0x88; // Re-do in order toguarantee ADC is ready for requests before Restart Event occurs
ADC0FLWCTL = 0x20; //ADC is restarted, RSTA bit is set: the first command of list 0 is loaded from memory.
//The command type does not matter, the conversion is immediately stopped
while(ADC0FLWCTL_RSTA == 1) {} // Wait for restart completion(within a few clock cycles)
ADC0FLWCTL = 0x40; // Start conversion(TRIG)
ADC0FLWCTL = 0x40; // The second TRIGimmediately generates a TRIG_EIF, ERROR state is entered
while (ADC0EIF_TRIG_EIF ==0) {} // Wait for trigger error interrupt flag (within a few clock cycles)
ADC0CTL_0_ADC_SR =1; // Execute ADC soft-reset (SR), ADC enters IDLE state
while (ADC0STS_READY == 0) {} //Wait for ADC soft-reset done (within a few clock cycles)
ADC0CTL_0 = 0x00; // ADC is disabled
ADC0TIM = tmp_ADCxTIM; //Restore previous customer settings
ADC0STS = tmp_ADCxSTS;
ADC0CTL_0 = tmp_ADCxCTL_0; // ADC0CTL_0 is the last one to berestored, in case ADC was enabled before...
}

0 Kudos

1,083 Views
RadekS
NXP Employee
NXP Employee

Hello Chaytanya,

The workaround for e8188 isn't part of your GoToSleep() function. Could you please share more details about how did you test it?

Is ADC triggered in some interrupt (edge interrupt, comparator, timer,...), or only by code in the main loop?

When you switch SW8 or SW9, the approximately 1mA current flows from VDDX to the GND through R21, R33,...

Did the power consumption fall back to the 240uA when you switch SW8, SW9 off?

Best regards

Radek

0 Kudos

1,084 Views
chaitanya_kalyani
Contributor III

Hello RadekS‌,

I am calling ADC workaround for e8188 before calling 'GoToSleep()' function.

 

Not using any interrupt. Just reading ADC data at 1ms interrupt basis in active mode only.

Yes, When SW8, SW9 is off then-current consumption falling back to 240uA.

In the project, there are only switches and no components to consume current and switches are connected in a similar way.

0 Kudos

1,084 Views
RadekS
NXP Employee
NXP Employee

Hello Chaitanya,

thank you for your clarification.

So, the power consumption when SW8 or 9 ON state may be limited by increasing resistor values. The other option is using HVI pin (PL0), which already contains a high ohm voltage divider with an option for routing to the ADC module.

When SW8 or 9 are OFF, the power consumption may be decreased by disabling potentially unnecessary clock sources (like an external oscillator, ACLK).

Additionally, you should avoid configuration with floating unused digital input pins.

Please look at Table 1-6. Pin Summary in RM and check reset state for unused pins. If the pull device is by default Off after reset, you should configure these pins into some known state (internal/external pull-up/down or digital output). For example port T pins.

Note: This is not necessary for port AD until we enable the appropriate digital input buffer (DIEN register). 

I hope it helps you.

Best reagrds

Radek

0 Kudos

1,084 Views
chaitanya_kalyani
Contributor III

Hello RadekS‌,

First thanks for your quick response.

I discussed it with a hardware engineer. He is saying that analog pin VDDX is connected to the VDDX pin of the microcontroller.

So, By disabling internal voltage regulator in sleep mode we can avoid taking high current by switches in sleep mode.

When I checked for datasheet I found this register.

pastedImage_4.png

and updated code as below. 

GoToSleep();
SCI0ACR1_RXEDGIE = 0; 
LP0CR_LPWUE = 0; 

CPMUVREGCTL_INTXON = 0;
CPMUVREGCTL_EXTXON = 0;

I observed the problem still exists.

How to overcome this problem.

0 Kudos

1,084 Views
RadekS
NXP Employee
NXP Employee

Hello Chaitanya Kalyani,

The VDDX cannot be disabled – the CPU is powered from it.

The CPMUVREGCTL allows configuring VDDX only in one of two configurations (select internal or external VDDX regulator). See table 9-30.

Additionally, this register may be written just once in normal mode (until next reset).

 

Both internal and external regulators are enabled by default after reset. Since the target voltage for the external regulator is slightly higher, the current will flow through external PNP when the external PNP transistor is assembled. So, this VDDX settings in CPMUVREGCTL is useful rather only for tuning applications during power dissipation tests (the external PNP transistor allows offload heat generated by VDDX regulator).

 

In fact, both internal and external regulators are disabled in MCU stop mode. The VDDX voltage in stop mode is driven by Reduced Performance Mode (RPM) regulator with the limited current capability and slightly lower accuracy. On another side, this regulator is resistant to the short circuit.

Hard to advise how valuable solve this circuit. This must be discussed with the original designer. The network looks quite complicated when it is just a switch(es).

Every resistor has a different dimension while R12 and R33 are quite big packages. Do you expect any high voltage at this point? Their requested accuracy (1%) also confuses me.

I guess that it works as a configuration switch measured by the ADC module (simple static voltage divider). Or is it something else?

From my point of view, the R12, R33 and R21 values may be simply ten times bigger or even more (e.g. 15k, 8k2, 30k). In such a case, the ADC voltages remain the same level and current through this divider probably drops below an acceptable level. Worst case 5V/(30k+8k2)=130uA  (I do not count with accuracy ranges, now)

On another side, the R44 value is quite big (100R or 1k is more typical). I would also recommend slightly increase C27 value. For minimize voltage drop during ADC measurement, the external capacitance should be bigger. 10 or 33nF sounds reasonable.   

I hope it helps you 

Best regards

Radek 

1,084 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello chaitanya.kalyani@seoyonelec-rnd.in,

The current consumption specified in the RM is taken at certain conditions which does not include the current to drive external loads (A.1.8.1.S12ZVL rev.2.48).

pastedImage_1.png

When SW9 is switched, the current sourced from VDDX is 5V / 5,32k = 0,94mA

BR, Daniel

0 Kudos