What is the minimum current for MC9S12G when two port pins are used as output, One for watchdog trigerring and another for LED blinking.

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

What is the minimum current for MC9S12G when two port pins are used as output, One for watchdog trigerring and another for LED blinking.

Jump to solution
1,797 Views
amitabh
Contributor I

I am using MC9S12G in my development . I want to know that what would be the minimum current consumed by controller when only two port pins are used as output,first port pin is used as to trigger the watchdog and other is used as for LED on/off(Flashing) activity.

I tried with MCU STOP mode , current consumption goes low but watchdog triggering also not happening  in stop mode.

As per my understanding in STOP mode CPU does not runs.

 

Please suggest how much minimum current needed to perform the above activity and how we can achieve that.

Labels (1)
Tags (2)
1 Solution
1,259 Views
RadekS
NXP Employee
NXP Employee

1. About stop mode

Yes, you are right.

In stop mode are “all” clocks stopped and CPU cannot trigger watchdog.

Solution is periodical wake-up just for triggering of watchdog.

I would like to recommend API as source for watchdog and as wake-up source. This 10kHz internal RC-oscillator has very low consumption. Price for this is lower accuracy (+/-5% for trimmed API clock), but we suppose that for periodically wake-up is this accuracy suitable.

In attachment you can find simple example code for periodically wake-up from stop mode and example code for trimming API clock.

2. About minimum current consumption in run mode

S12G is CMOS device, therefore consumption is almost linear dependent on bus clock. Enabled peripherals present in this case just small part of total consumption. So, I would like to recommend focus mainly on external load and bus frequency.


View solution in original post

11 Replies
1,259 Views
Monica
Senior Contributor III

Amitabh, how is the project going?

Keep us posted! :smileyhappy:

Regards!

0 Kudos
1,260 Views
RadekS
NXP Employee
NXP Employee

1. About stop mode

Yes, you are right.

In stop mode are “all” clocks stopped and CPU cannot trigger watchdog.

Solution is periodical wake-up just for triggering of watchdog.

I would like to recommend API as source for watchdog and as wake-up source. This 10kHz internal RC-oscillator has very low consumption. Price for this is lower accuracy (+/-5% for trimmed API clock), but we suppose that for periodically wake-up is this accuracy suitable.

In attachment you can find simple example code for periodically wake-up from stop mode and example code for trimming API clock.

2. About minimum current consumption in run mode

S12G is CMOS device, therefore consumption is almost linear dependent on bus clock. Enabled peripherals present in this case just small part of total consumption. So, I would like to recommend focus mainly on external load and bus frequency.


1,259 Views
amitabh
Contributor I

Thanks Radek,

I think your suggestion will work. Can you please tell me how much will be current consumption by mcu when API is used. 

0 Kudos
1,259 Views
RadekS
NXP Employee
NXP Employee

Maximum consumption of API clock source is approximately 5uA (10uA at 150°C).

Please check full stop mode current consumption for your derivative in reference manual - Table A-17. Full Stop Current Characteristics – page 1209.

Be aware this consumption is consumption of MCU itself. It didn’t contain any external load.

There it is also necessary periodically wake-up MCU for watchdog triggering. During this time consumption refers to run mode (please check Table A-15. Run and Wait Current Characteristics). As I already noted consumption in run mode depends mainly on bus frequency (linear dependency). Values from Table A-15 are related to maximum 25MHz bus clock.

For total consumption calculation you should know external loads, consumption of MCU in stop mode, consumption of MCU in run mode and rate between time in run mode and full stop mode. 


0 Kudos
1,259 Views
hareeshakoratik
Contributor II

Hi Redak,

          Does micro controller gets reset after STOP function?.

I am using STOP mode functionality twice in our project. Like Below:

Function1

{

---

Initializations

---

    {

        asm andcc #$7f

        asm STOP

Function3();   

    }

}

Function3

{

Function2()

}

Function2

{

---

Initializations

---

    {

        asm andcc #$7f

        asm STOP

    }

}

Function1 is calling at every 60 Seconds and Function2 calls at every 13 seconds. I am not getting MCU reset for interrupt which occur between around 0 to 14 seconds but MCU gets reset for 15 to  60 second interrupt occurs. Same will continue for next time interval also. MCU is going to STOP mode at all interval but it gets reset at second STOP mode. May I know the reason behind MCU reset?

Thanks & Regards,

Hareesha.

0 Kudos
1,259 Views
RadekS
NXP Employee
NXP Employee

Unfortunately I am not sure what could be root cause of MCU reset in your case. You description is not enough detail.

  1. Did you enable watchdog? How do you trigger watchdog? Which clock source is selected for watchdog?
  2. Could you please check CPMUFLG register after unexpected MCU reset (for example display value by LEDs)?
  3. How did you wake-up your MCU from stop mode?

Note: In fact, you don’t need clear S bit (asm andcc #$7f) prior any entrance to stop mode. You can move command “asm andcc #$7f” to first Initializations section. This command clears S bit in CCR register and only MCU reset sets this bit again.

1,259 Views
hareeshakoratik
Contributor II

Hi Radek,

Thanks for your reply.

Please find the answer for your questions.


  1. Did you enable watchdog?

  Ans: Yes. 

  1. How do you trigger watchdog?

Ans: Watch dog is served to ATM 6628. If ATM 6628 is not receiving with in around 150ms after it transfer, it will resets MCU.

  1. Which clock source is selected for watchdog?

  Ans: I am using internal oscillator during Sleep mode. 

                                    CPMUPROT_PROT = 0;

                                    CPMUCLKS_PLLSEL = 0;

                                    CPMUPOSTDIV = 0x03;

                                    CPMUOSC_OSCE = 0;

  1. How did you wake-up your MCU from stop mode?

Ans: I am using LIN interrupt and other 3 I/O interrupt (Total 4) for Wakeup from STOP mode. MCU is not resetting for I/O interrupts Wake up but it is resetting for LIN interrupt Wakeup.

Note: Following is the configuration I am using in my function 1 and Function 3:

{

    /* disable SPI interrupt */

    SPI0CR1_SPIE = 0u;

    /* disable ADC interrupt */

    ATDCTL2_ASCIE = 0u;

    /* disable CLOSE_OVP_FET interrupt */

    PIE1AD_PIE1AD1 = 0u;

    /* Set micro into pseudo stop mode */

    CPMUCLKS_PSTP = 1u;

CPMUCLKS_PRE = 0u;

    /* Set API clock*/

    CPMUAPICTL_APIFE = 0u;

    CPMUAPICTL_APICLK = 0u;

    CPMUAPICTL_APIEA = 0u;

    CPMUAPICTL_APIES = 1u;

    /* Clock configuration */

    CPMUAPIRL = 0xFFu;

    CPMUAPIRH = 0xFFu;

    /* Enable API */

    CPMUAPICTL_APIE = 1u;

    CPMUAPICTL_APIFE = 1u;

    /* Enable edge detect to wakeup on LIN Rx */

    SCI0SR2_AMAP = 1u;

    SCI0ACR1_RXEDGIE = 1u;

    SCI0SR2_AMAP = 0u;

    /* Enable internal clock source */

    //Enable_Internal_Osc();

    /* Place LIN transceiver in "sleep" mode */

    /**/

    PT1AD_PT1AD4 = 1u;

    DDRS_DDRS1 = 1u; /* configure TXD as an output */

    PTS_PTS1 = 1u;

    PT1AD = 0u; /* falling edge of EN pin */

    SCI0CR2_TE = 0u; /* re-enable TXD */

    SCI0CR2_RE = 1u; /* re-enable RXD */

    /* Skip going to sleep if a wakeup happens before we stop, but after we checked before */

    if ( (!Get_LIN_Wakeup())

                    && (!Get_OC_Wakeup())

                    && (!Get_Charger_On_Wakeup())

                    && (!Get_HW_OVP_Wakeup())

    )

    {

                    /* disable RTI interrupt */

    CPMUINT_RTIE = 0u;

    Enable_Internal_Osc();   /* Enable internal clock source */

        asm andcc #$7f

        asm STOP

    }

}


Kindly let me know any of my configurations is wrong for LIN Wakeup.

Thanks and Regards,

Hareesha.

0 Kudos
1,259 Views
RadekS
NXP Employee
NXP Employee

I do not see anything really wrong in your code.

By watchdog I thought internal COP watchdog. But thank you for additional information.

I suppose now that you don’t use COP watchdog.

I guess that you mean ATA6628 (LIN Bus Transceiver with 3.3V (5V) Regulator and Watchdog).

Please check duration of reset signal at RESET pin. If source of reset is ATA6628 reset time (when RESET pin is low) should be around 4ms. If reset is caused by MCU, reset time (when RESET pin is low) should be in tens of us.

In second case, please check CPMUFLG register and especially ILAF bit after unexpected MCU reset (it signalize that Illegal Address Reset).

Strange is that you enable pseudostop mode and simultaneously you disable oscillator.

0 Kudos
1,259 Views
1090097669
Contributor III

Hi Radek Sestak,

   I am also using this chip for Pseudo Stop Mode,and wake it up from can wake up Interrupt ,however ,i can not confirm the program runing position after MCU waked,and MCU encounter reset ,Please check my fault of my code;

void interrupt Vcanwkup_ISR(void)
{
CANRFLG_WUPIF = 1;
CANRFLG = 0x80;
CANCTL0 = 0x00;
CANRIER = 0x01;
PLL_init();
if(TRUE == systemGotoSleepModeFlag)
{
//_MCU_Reset();
_MCU_Reset_Flag = 1;
}
}

the other function

{

    if(_MCU_Reset_Flag == 1)
{
_MCU_Reset_Flag = 0;
_MCU_Restart();
}
 

}

thanks very much

Regards!

0 Kudos
1,259 Views
RadekS
NXP Employee
NXP Employee

Hi Katrinal,

We may continue in your new thread:
https://community.nxp.com/message/1177901?commentID=1177901#comment-1177901 
Best regards

Radek

0 Kudos
1,259 Views
hareeshakoratik
Contributor II

Hi Radek,

          Thanks for the information.

          It confirms that, reset is from external, In our case it is due to ATM6628 IC. We are miss configuring something related this IC. I am looking looking into that.

Thanks once again.

Regards,

Hareesha.

0 Kudos