LPC1758 : Power Down not working when second bootloader is used

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

LPC1758 : Power Down not working when second bootloader is used

649 Views
gph
Contributor III

Hi,

I have a strange behavior, my program is working well when i use it as normal.

When i use bootloader and put my program with an offset in flash, the __WFI make nothing !

All is correct, i checked PCON & SCR but when __WFI is executed the processor don't enter in sleep mode.

My debug probe doesn't disconnect, current stay in full range and my program goes on ...

Is someone have hints ?

Because i don't understand and don't know where search for correct this.

Thanks a lot, Philippe.

PS : The bootloader is used for firmware flash from USB Key and is working (many used before this try)

Sorry for my english.

0 Kudos
3 Replies

558 Views
jeremyzhou
NXP Employee
NXP Employee

Hi  Philippe GRAILLE,

Thank you for your interest in NXP Semiconductor products and 
for the opportunity to serve you.

I'd like to confirm something from you, hope you can clarify the following inquiries.

1. Whether you can share the code which is used to enter sleep mode.

2. Whether the enter sleep mode function is available when MCU run the bootloader code.

Have a great day.
TIC
 
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
0 Kudos

558 Views
gph
Contributor III

Hi,

Thanks for help.

1) Here the sleep code. The lpc_chip library is the LPCOpen V2.10 for LPC17XX

void Sleep(void)
{
    // Stop peripherals
    nRF_Stop();
    Board_SPI_CS(OUT_SPI_NONE);

    Chip_PMU_Sleep(LPC_PMU, PMU_MCU_POWER_DOWN);      

}

/* From lpc_chip_175x_6x */
/* Enter MCU Power down mode */
void Chip_PMU_PowerDownState(LPC_PMU_T *pPMU)
{
    /* Select power down mode */
    pPMU->PCON = (pPMU->PCON & ~PMU_PCON_PM1_FLAG) | PMU_PCON_PM0_FLAG;

    /* Setting SLEEPDEEP bit in SCR makes it power down mode */
    SCB->SCR |= (1UL << SCB_SCR_SLEEPDEEP_Pos);

    /* Enter sleep mode */

    __WFI();
}

2) No sleep in bootloader. It's only stat check if USB Key is here and jump to user code.

Thanks, have a great day too.

Philippe.

0 Kudos

558 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Philippe GRAILLE,

Thanks for your reply.

To terminating some tricky errors, you'd better to execute the following code prior to enter power down mode.

     /*---------- Disable and disconnect the main PLL0 before enter into Deep-Sleep
      */
     LPC_SC->PLL0CON &= ~(1<<1); /* Disconnect the main PLL (PLL0) */
     LPC_SC->PLL0FEED = 0xAA; /* Feed */
     LPC_SC->PLL0FEED = 0x55; /* Feed */
     while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00); /* Wait for main PLL (PLL0) to disconnect */
     LPC_SC->PLL0CON &= ~(1<<0); /* Turn off the main PLL (PLL0) */
     LPC_SC->PLL0FEED = 0xAA; /* Feed */
     LPC_SC->PLL0FEED = 0x55; /* Feed */
     while ((LPC_SC->PLL0STAT & (1<<24)) != 0x00); /* Wait for main PLL (PLL0) to shut down */
     /*------------Then enter into PowerDown mode ----------------------------------*/
Have a great day.
TIC
 
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
0 Kudos