LPC43S57 : Reset during Sleep Mode do not work

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC43S57 : Reset during Sleep Mode do not work

1,611 次查看
julienbrissard
Contributor II

Hello,

Reset (Pin \reset) works correctly during execution of my software (without sleep mode).

But if I enter in sleep mode, then reset pin has no effect.

I thought that  nothing could avoid a reset

Somebody has a clue ?

I got lot of trouble with DeepSleep mode, so I am not sur to be in Sleep or Deep Sleep mode.

In which condition  reset pin could be disable, I found nothing in datasheet about that ?

Here after the code that I use to enter in Sleep mode :

    /* Disable ADC Interrupt */
    NVIC_DisableIRQ(ADC1_IRQn);
    NVIC_ClearPendingIRQ(ADC1_IRQn);
    /* Disable de l'IT RIT */
    NVIC_DisableIRQ(RITIMER_IRQn);
    NVIC_ClearPendingIRQ(RITIMER_IRQn);
    /* Disable de l'interruption */
    // TBD NVIC_DisableIRQ(UARTx_IRQn);
    // NVIC_ClearPendingIRQ(UARTx_IRQn);
    /* Disable de l'interruption */
    NVIC_DisableIRQ(I2C0_IRQn);
    NVIC_ClearPendingIRQ(I2C0_IRQn);
    /* Disable de l'interruption */
    NVIC_DisableIRQ(I2C1_IRQn);
    NVIC_ClearPendingIRQ(I2C1_IRQn);
    /* Disable de l'interruption */
    NVIC_DisableIRQ(SCT_IRQn);
    NVIC_ClearPendingIRQ(SCT_IRQn);
    /* Disable de l'interruption CAN*/
    NVIC_DisableIRQ(C_CAN0_IRQn);
    NVIC_ClearPendingIRQ(C_CAN0_IRQn);
    /* Disable watchdog */
    NVIC_DisableIRQ(WWDT_IRQn);
    NVIC_ClearPendingIRQ(WWDT_IRQn);
    /* Stop Tick */
    SysTick->CTRL = 0;

    /* Clock management before sleep */
    Chip_SetupIrcClocking();

    // Clear all event
    LPC_EVRT->CLR_STAT = 0xFFFFFFFF;

    /* Configure wake up signal */
    PMC_Evrt_Configure(EVRT_SRC_WAKEUP0);

    Chip_EVRT_ConfigIntSrcActiveType(EVRT_SRC_WAKEUP1, EVRT_SRC_ACTIVE_HIGH_LEVEL);
    Chip_EVRT_ConfigIntSrcActiveType(EVRT_SRC_WAKEUP2, EVRT_SRC_ACTIVE_HIGH_LEVEL);
    Chip_EVRT_ConfigIntSrcActiveType(EVRT_SRC_WAKEUP3, EVRT_SRC_ACTIVE_HIGH_LEVEL);
    Chip_EVRT_ConfigIntSrcActiveType(EVRT_SRC_ATIMER, EVRT_SRC_ACTIVE_HIGH_LEVEL);
    Chip_EVRT_ConfigIntSrcActiveType(EVRT_SRC_RTC, EVRT_SRC_ACTIVE_HIGH_LEVEL);

    LPC_EVRT->HILO = 0x237EBFF;
    // Clear all event
    LPC_EVRT->CLR_STAT = 0xFFFFFFFF;

    // contournement pb (cf errata sheet)
#define CREG0_008 (0x40043008)

    regval = *((unsigned int *) CREG0_008);
    regval |= (1 << 17);
    regval &= ~(1 << 16);
    *((unsigned int *) CREG0_008) = regval;

    /* Deep-Sleep Mode*/
    /* Set Deep sleep mode bit in System Control register of M4 core */
    SCB->SCR |= 0x4;
    /* Set power state in PMC */
    Chip_PMC_Sleep();

    /* Wait For Interrupt */
    __WFI();

标签 (1)
标记 (2)
0 项奖励
回复
6 回复数

1,290 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi julien,

    Thank you for your interest in NXP LPC Product, I would like to provide service for you.

    From your code, I find you are using the deep sleep mode, not the sleep mode.

   But as I know, both the deep sleep and the sleep mode, the reset all can wake it up.

   And I have tested it in our MCB4357 board with the lpcopen pmc_states, this is the test result:

==========================================================================
NXP Semiconductors LPC18xx/43xx MCU Power Management Controller example      
=============================================================================
Select the power state test to be executed                           
 - Sleep state & Wake up test           : Press '1' to select        
 - Deep Sleep state & Wake up test      : Press '2' to select        
 - Power down state & Wake up test      : Press '3' to select        
 - Deep power down state & Wake up test : Press '4' to select        
 - Exit the demo                        : Press 'X' or 'x' to select
=============================================================================
'Deep Sleep' state test selected

Select the Wake up signal                      
 - WAKEUP0 pin : Press 'W' or 'w' to select    
 - RTC Alarm   : Press 'R' or 'r' to select    
WAKEUP0 pin selected

Press 'C' or 'c' to start demo...
Entering 'Deep Sleep' state ...
Press WAKEUP0 button/Connect WAKEUP0 pin to 3.3V to exit 'Deep Sleep' mode

==========================================================================
NXP Semiconductors LPC18xx/43xx MCU Power Management Controller example      
=============================================================================
Select the power state test to be executed                           
 - Sleep state & Wake up test           : Press '1' to select        
 - Deep Sleep state & Wake up test      : Press '2' to select        
 - Power down state & Wake up test      : Press '3' to select        
 - Deep power down state & Wake up test : Press '4' to select        
 - Exit the demo                        : Press 'X' or 'x' to select
=============================================================================

You can find after entering the deep sleep mode, the printf information let to press WAKEUP0 to wake up the chip.

But i press the reset button, I also make the chip wake up.

So, I think you can try our official code:

LPCOpen Software for LPC43XX|NXP 

Besides, about the RESET pin circuit, I don't know how you design it, you need to add the external pull up and 0.1uf capacitor to ground.

Wish it helps you!


Have a great day,
Kerry

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

0 项奖励
回复

1,290 次查看
julienbrissard
Contributor II

Hi Kerry,

Thank you for your answer.

I am confused since reset works on the eval board, even in deep sleep, but not on my specific product board (only during deep sleep).

I have 2 versions of my software, one for the evaluation board and the other for the specific product board. There are few differences:

Eval board :

- Micro : LPC4357 (version "-" with incompatibility beetween ADC and CAN) for eval board

- ADC is disable because it cannot work with CAN

Specific product board :

- Micro : LPC43S57 (version "A")

- Pin allocation is a different, but everthing works fine, also "reset" when I am not in Deep Sleep

So I have two questions :

- Could you test the lpcopen pmc_states on an eval board with LPC43S57 in order to know if the version of micro could have an effect on reset (even if probability is very low) ?

- If we are agree that deep sleep have no effect on reset, do you know some conditions that could leads to this situation (Reset do not restart PMC or clock or do not reinit RAM or ...) ? so I will be able to check if I activate one of this condition by mistake.

0 项奖励
回复

1,290 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi julien brissard,

    Thanks a lot for your updated information.

    So sorry for my later reply because the weekends and my annual leave yesterday.

   I have tested the LPC43S67 on my side, I can reproduce your problem.

   After checking our errata, I find the according information about it.

https://www.nxp.com/docs/en/errata/ES_LPC435X_3X_2X_1X_FLASH.pdf 

page 25, 3.19 RESET.3.

There has a workaround.

Wish it helps you!

  


Have a great day,
Kerry

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

0 项奖励
回复

1,290 次查看
julienbrissard
Contributor II

Hi Kerry,

Thank you for your help.

I tried to implement the work-around but it is not working.

1- Is it working on LPC43S67 ?

2- I put the work-around code inside SystemInit() function (just before the call of Chip_SystemInit), is it correct ?

3- I do not understand the work-around, why should we set power state in PMC (since it is already set) ? I thought that we should reset this information instead of ?

0 项奖励
回复

1,290 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi julien brissard,

   Sorry for my later reply.

1- Is it working on LPC43S67 ?

Answer:

   Yes, it should work on LPC43S67, because the LPC43S67 errata also have this work-around.

   https://www.nxp.com/docs/en/errata/ES_LPC43S6X_FLASH.pdf 

2- I put the work-around code inside SystemInit() function (just before the call of Chip_SystemInit), is it correct ?

  Answer: it should be work, please share your modified code with me, I will help you to check it.

3- I do not understand the work-around, why should we set power state in PMC (since it is already set) ? I thought that we should reset this information instead of ?

Answer: Let's make it work at first, actually, it's want to do the software reset under deep sleep reset.


Have a great day,
Kerry

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

0 项奖励
回复

1,290 次查看
julienbrissard
Contributor II

Hi Kerry,

1- When I ask you if it is working on LPC43S67, I means : Did you implement the work-around on LPC43S67 board and did you check that it works correctly ?

2- The code that I used is :

    if((LPC_PMC->PD0_SLEEP0_MODE == PMC_PWR_DEEP_SLEEP_MODE)
        || (LPC_PMC->PD0_SLEEP0_MODE == PMC_PWR_POWER_DOWN_MODE))
    {
        /* Check if the wake up event is due to nRESET pin in Event router */
        if(LPC_EVRT->STATUS & (1<<19))
        {
            /* Set power state in PMC */
            LPC_PMC->PD0_SLEEP0_MODE = PMC_PWR_DEEP_POWER_DOWN_MODE;
            /* Set CORE_RST in RGU */
            //LPC_RGU->RESET_CTRL0 = (1<<0);
            LPC_RGU->RESET_CTRL[0] = (1<<0);
        }
    }

You can see that, comparing to the official work-around, I only modifiy the line "LPC_RGU->RESET_CTRL0 = (1<<0);" to "LPC_RGU->RESET_CTRL[0] = (1<<0);"

Best regards,

Julien B.

0 项奖励
回复