SysTick,VLPS ,Debug

cancel
Showing results for 
Search instead for 
Did you mean: 

SysTick,VLPS ,Debug

1,644 Views
liuruowen
Contributor I

Hello,   

    SysTick  will affect entering into VLPS?

   when I am debugging,the SysTick  is tunned off before entering VLPS,it stops。

   when I am debugging,the SysTick  isn't tunned off before entering VLPS,it do not stops,why?

Tags (1)
0 Kudos
18 Replies

1,139 Views
liuruowen
Contributor I

@Diana Batrlova

Hello,

      Is there such the problem on your side?

      So,Is the SysTick one of the wakeup sources?What is the solution to this problem?

      Looking forward to your reply.

Best regards

0 Kudos

1,139 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

I have tested the power_mode_switch_s32k144 example and when I enable the OSIF_TimeDelay(25); under the

"case '6':" in the code. I was able to enter into VLPS mode without any problem.

No, the SysTick is not the wakeup source when you are not in debug mode. Please, make sure, the debugger is not attached.

Best regards,

Diana

0 Kudos

1,139 Views
liuruowen
Contributor I

dianabatrlova

Hello:

      

      So,you only add OSIF_TimeDelay(25) under the "case '6': ",you can try it below:

pastedImage_2.png

Add the code of "① ② ③ ", It will exit the VLPS mode directly. It didn't work as I expected.

Add the code of "② ③ ", It wll work normally。

0 Kudos

1,139 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello

I have tested the same code as you shared with me and VLPS works as expected. I was able to enter into VLPS with additional code "① ② ③ ".

I assume the root cause of your issue is that the debugger is still attached. Important note: the power cycle is required after debugging.

Also, I recommend you to use the newest SDK version S32 Design Studio for ARM 2018.R1 - Update 10 available 

I hope it helps. If not, could you please share your project?

Best Regards,

Diana

0 Kudos

1,139 Views
liuruowen
Contributor I

dianabatrlova

Hello:

      Please check the attachment, the attachment is my project.

      Below is the environment  I tested:

      pastedImage_1.png

1)Press Reset Key, See below:

pastedImage_2.png

2)Prepare to send ‘6’ ,Select “6) for VLPS”, see below:

pastedImage_3.png

3) Send send ‘6’,see below:

pastedImage_4.png

0 Kudos

1,139 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

I have tested your code and still cannot reproduce your issue.

Please, see the steps after the load project:

I'm using OpenSDA UART.

1. Disconnect the power supply

pastedImage_3.png

2. Connect the power supply and press reset and press key number '6'

pastedImage_4.png

Also, I measure the current 0.15 mA which confirms that MCU is in VLPS mode:

pastedImage_5.png

Best Regards,

Diana

0 Kudos

1,139 Views
liuruowen
Contributor I

dianabatrlova

Hello,

   Sorry,Maybe I didn't disconnect the power supply last time, causing problems.

   But,trouble you here is trying the code below:

    pastedImage_1.png

 1 disconnect the debuger;

 2 disconnected the power supply;

 3 connect the power supply and reset;

 4 first ,it can enter VLPS, second ,it can not enter VLPS( exist from VLPS directly)。

 

 Best Regards

0 Kudos

1,139 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

In this case, It is woken up by the pending interrupt.

Best Regards,

Diana

0 Kudos

1,140 Views
liuruowen
Contributor I

dianabatrlova

Hello,

   I am bothering you again. What should I do if I encounter the above problems?

 

     pastedImage_1.png

   Best Regards

0 Kudos

1,140 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

I would like to apologize for the delay. I recommend you to look at the ARMv7-M Architecture
Reference Manual https://static.docs.arm.com/ddi0403/eb/DDI0403E_B_armv7m_arm.pdf  

In this case, the exception becomes pending after the global interrupts are disabled.

You can test that if you comment the INT_SYS_DisableIRQGlobal() function, the MCU enter VLPS successfully.

Note: The SysTick pending status can be clear by PENDSTCLR bit located in ICSR register. This bit removes the pending status of the SysTick exception. 

Best Regards,

Diana

0 Kudos

1,140 Views
liuruowen
Contributor I

dianabatrlova

Hello:

   Now i have some questions.  In the last reply,the SysTick is not one of the wakeup source.Then, why is it woken up by the SysTick pending interrupt?

   The SDK does not provide an interface to clear the pending interrupt, In this case ,what should I do?

Best Regards

0 Kudos

1,140 Views
liuruowen
Contributor I

So ,SysTick is one of wake up source(WFI)?  if the SysTick  pending flag set, it will exit VLPS deirectly?

0 Kudos

1,140 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

If you are in debug mode and you enter to VLPS which is actually emulated stop state the core clock is enabled. That is mean the SysTick is enabled. In that case, the SysTick is wake up source and it will exit the emulated stop state.

If you do not have attached debugger the SysTick should be disabled and you should be able to enter VLPS.

Best Regards,

Diana

0 Kudos

1,140 Views
liuruowen
Contributor I

So,the SysTick is one of the wake up source。

If I don't use the FreeRTOS component, the use of some components will open the SysTick,but there is no closed interface. will this is optimized?

I use the demo project of the power_mode_switch_s32k144.

I modify the code,see below:

 

/* VLPS */
case '6':
//OSIF_TimeDelay(25);
print((const char*)"******** CPU is going in VLPS and need interrupt to wake up CPU\r\n");
/*Board EVB - red led on
Board MB - led 0 on */
PINS_DRV_WritePin(LED_PORT, LED_0, 0);
/*Board EVB - green led off
Board MB - led 1 off */
PINS_DRV_WritePin(LED_PORT, LED_1, 1);


/* Set power mode to VLPS */
//retV = POWER_SYS_SetMode(VLPS, POWER_MANAGER_POLICY_AGREEMENT);

EcuM_EnterLPM();

if (retV == STATUS_SUCCESS)
{
print((const char*)"CPU was entered VLPS mode successfully and then woke up to exit VLPS mode.\r\n");
if (POWER_SYS_GetCurrentMode() == POWER_MANAGER_RUN)
{
print((const char*)"Current mode is RUN.\r\n");
}
else
{
print((const char*)"Current mode is VLPR.\r\n");
}
}
else
{
print((const char*)"Switch VLPS mode unsuccessfully\r\n");
}
break;

/**
* \brief the ECU Enter Lower Power Mode.
*
* \param None
*
* \return None
*
* \note Before calling this function , the peripheral and power must be turned off.
*/
void EcuM_EnterLPM(void)
{
Mcu_DisableGlobalIRQ(); /* Step 1,disable global IRQ.*/
EcuM_ResetPortCfg(); /* Step 2,Reset the port configurations. */
EcuM_EnableWakeupSource(); /* Step 3,Enable wake up source. */
Mcu_EnterPLM(); /* Step 4,enter the PLM mode,Step5,wait for interrupt. excute POWER_SYS_SetMode(VLPS, POWER_MANAGER_POLICY_AGREEMENT);  */
EcuM_RecordWakeupEvent(); /* Step 6,record wake up event. */
EcuM_DisableWakeupSource(); /* Step 7,disable wake up source,and clear interrupt flag.*/
Mcu_EnableGlobalIRQ(); /* Step 8,enable global IRQ.*/
}

When I mask the code OSIF_TimeDelay(25), the actual operation can enter the VLPS mode. When I open the code OSIF_TimeDelay(25), the actual operation will exit directly from the VLPS mode and cannot enter low power consumption. So,Is this normal operation?

So the SysTick is the one of wake up source? Can you optimize the interface of the SDK to close the SysTick?

0 Kudos

1,140 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello, 

At first, please let me confirm some questions:

When you debug the code the described issue appears, right?

If you do not use the debugger, the code is running as expected, right?

Which version of the SDK do you use?

Thank you in advance.

Best Regards,

Diana

0 Kudos

1,140 Views
liuruowen
Contributor I

Hello,

   When you debug the code the described issue appears, right?

   No. it will appearr when i actually run it.

   If you do not use the debugger, the code is running as expected, right?

   No. the actual operation did not work as I expected.

   Which version of the SDK do you use?

   SDK2.9.0

0 Kudos

1,140 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

The similar question was already discussed in the community thread below:

https://community.nxp.com/message/1160023 

You can refer to RM rev 11. section 39.4.5.

I believe it helps.

Best Regards,

Diana

0 Kudos

1,140 Views
liuruowen
Contributor I

So ,SysTick is one of wake up source(WFI)?  if the SysTick  pending flag set, it will exit VLPS deirectly?

0 Kudos