LPC55S69 : POWER_EnterPowerDown() preconditions

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

LPC55S69 : POWER_EnterPowerDown() preconditions

1,702 Views
EugeneHiihtaja
Senior Contributor I

Hi !

it is not so clear from UM if POWER_EnterPowerDown() can be called when  all interrupts is disabled

by _disable_irq() or when CPU run in unprivileged or handler mode.

It is important to undestand at what place of FreeRTOS framework I can call this function and where is not.

Also in remark mentioned :

"

The HARD FAULT handler should execute from SRAM and not from Flash. (The hard
fault handler should initiate a full chip reset).

"

I can allocate HF handler in SRAM but will it work or I should allocate entire Interrupt table in SRAM and modify VTOR ?

or handler is enough ?

Regards,

Eugene

Labels (1)
0 Kudos
9 Replies

1,513 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Eugene,

 

Sorry for the late reply. I will be taking over this case, you are correct POWER_EnterPowerDown API modifies NVIC->ISER so if you disable interrupts before calling it, the API will set their interrupt wake-up source.

 

Best regards,

Felipe

0 Kudos

1,513 Views
EugeneHiihtaja
Senior Contributor I

Hi nxf46115‌ !

I'm calling this API on secure side and what is not clear if it manipulate with global interrupt enable as well.

Some wake up interrupts processed on secure side and some of those on nonsecure side.

Can it be like this :

at entry to POWER_EnterPowerDown :

- enable all interrupts what is need for wakeup ( secure and nonsecure side)

- enable global interrupts , secure and nonsecure side.

--- 

at exit :

- disable global interrupts if the were disabled at entry point

- disable wakeup interrupts if they were disabled at entry to this API.

So at exit API return back all interrupts registers to state what were at entry moment.

Can it be so ?

Or it manipulate with local/global interrupt in other way ?

Regards,

Eugene

0 Kudos

1,513 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Eugene,

 

The User Manual states the following:

• CPU0 interrupt enable registers (NVIC->ISER) are modified by POWER_EnterDeepSleep, POWER_EnterPowerDown, and POWER_EnterDeepPowerDown power APIs. They are restored in case of CPU retention (deep-sleep and in power-down) or if the low power mode is not entered (for example, a pending interrupt).

 

• The Non Maskable Interrupt (NMI) is disabled and its configuration before calling this function will be restored back in case of CPU retention – deep-sleep and in power-down - or if the low power mode is not entered (for instance because an interrupt is pending).

You are correct, API should return back all interrupts registers to their initial state.

 

Best regards,

Felipe

0 Kudos

1,513 Views
EugeneHiihtaja
Senior Contributor I

Hi felipegsoto‌ !

But what about global interrupt on secure and nonsecure side ?

Can they be disabled or must be enabled or how PowerDown API handle PRIMASK register ?

Regards,

Eugene

0 Kudos

1,513 Views
FelipeGarcia
NXP Employee
NXP Employee

Hello Eugene,

 

You can refer to the POWER_EnterSleep implementation in user manual. This will give you an idea if how POWER API handles global interrupts.

void POWER_EnterSleep(void)
{
   uint32_t pmsk;
   pmsk = __get_PRIMASK(); /* Save interrupt configuration */
   __disable_irq(); /* Disable all interrupts */
   SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk; /* processor uses sleep */
   __WFI(); /* Enter sleep mode */
   __set_PRIMASK(pmsk); /* Restore interrupt configuration */
}‍‍‍‍‍‍‍‍‍

Have a great day,
Felipe

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,513 Views
EugeneHiihtaja
Senior Contributor I

Hi felipegsoto‌ !

But what about PowerDown API call on Secure side ?

Does it handle Secure and Nonsecure global interrupts in similar way ?

Regards,

Eugene

0 Kudos

1,513 Views
FelipeGarcia
NXP Employee
NXP Employee

Should be similar way.

 

Best regards,

Felipe

0 Kudos

1,513 Views
soledad
NXP Employee
NXP Employee

Hello Eugene,

IF you enter the device into Power-down, the chip it is only working with the sufficient  modules to prevent to return from this mode, it is like in your Laptop if you put the device, not in sleep but you go into Power Down, but not shut off, so you cannot enter in Power Down if you disable the interrupts even in unprivileged or handle mode.  Regarding the SRAM, you should allocate only the interrupts that you plan to use to restart from Power-down in the SRAM.

0 Kudos

1,513 Views
EugeneHiihtaja
Senior Contributor I

Hi soledad‌ !

I' using POWER_EnterPowerDown()  in secure side via NSC call from Nonsecure side.

and secure and nonsecure interrupts are used as wakeup sources.

_disable_irq() is called on nonsecure side

and secureportDISABLE_SECURE_INTERRUPTS(); can be called on Secure side.

But looks like it is dosn't matter -> wakeup happens in any case.

in UM mantioned that API manipulate with NVIC->ISER and may be they need privileged access as well.

Also POWER_API code located in ROM what also need to have Secure attributes.

So there are a lot of limitations if API should be used in real system.

May be if I use secure and nonsecure interrupts for wakeup I should allocate call on Secure side.

But it would be nice to understand all limitation/preconditions for this API from UM.

Regards !

Eugene

0 Kudos