AnsweredAssumed Answered

Self wake up LPC1347

Question asked by santiagoalmandos on Sep 5, 2016
Latest reply on Sep 29, 2016 by santiagoalmandos

hello, I'm working with lpc1347 and trying to make a self timed wake up.
i've worked with lpc1114 and 15 and had no problems.
Another thing is that the SCR register is not described in UM10524, where can I find information about memory map?

 

I modified the PMU example. it looks like the clock stops because when the WFI is not executed (not deep-sleep), the code works fine

 

#define GPIO_PININT_PIN     24    /* GPIO pin number mapped to PININT */
#define GPIO_PININT_PORT    1    /* GPIO port number mapped to PININT */
#define GPIO_PININT_INDEX   0    /* PININT index used for GPIO mapping */

 

void PIN_INT0_IRQHandler(void)
{
    NVIC_ClearPendingIRQ(PIN_INT0_IRQn);
    Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH(GPIO_PININT_INDEX));
    Chip_TIMER_ExtMatchControlSet(LPC_TIMER32_0, 0, TIMER_EXTMATCH_SET, 0);
    Board_LED_Toggle(0);
}

 


int main(void)
{   

    SystemCoreClockUpdate();
    Board_Init();


    Board_LED_Set(0, false);

 

    Chip_IOCON_PinMuxSet(LPC_IOCON, GPIO_PININT_PORT, GPIO_PININT_PIN, (IOCON_FUNC1 |                                                    IOCON_MODE_INACT)); //TIMER32_0_MAT0

 

   //PININT

    Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_PINT);
    Chip_SYSCTL_SetPinInterrupt(GPIO_PININT_INDEX, GPIO_PININT_PORT, GPIO_PININT_PIN);

 

    Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH(GPIO_PININT_INDEX));
    Chip_PININT_SetPinModeEdge(LPC_PININT, PININTCH(GPIO_PININT_INDEX));
    Chip_PININT_EnableIntHigh(LPC_PININT, PININTCH(GPIO_PININT_INDEX));

 

    Chip_SYSCTL_EnableStartPin(GPIO_PININT_INDEX);

    NVIC_ClearPendingIRQ(PIN_INT0_IRQn);
    NVIC_EnableIRQ(PIN_INT0_IRQn);

 

    //CLK

    Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_WDTOSC_PD);
    Chip_Clock_SetWDTOSC(WDTLFO_OSC_0_60, 64);
    Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_WDTOSC);
    SystemCoreClockUpdate();

 

   //TIMER

   Chip_TIMER_Init(LPC_TIMER32_0);
    Chip_TIMER_Reset(LPC_TIMER32_0);
    Chip_TIMER_PrescaleSet(LPC_TIMER32_0, 0);
    Chip_TIMER_MatchDisableInt(LPC_TIMER32_0, 0);
    Chip_TIMER_ResetOnMatchEnable(LPC_TIMER32_0, 0);
    Chip_TIMER_StopOnMatchDisable(LPC_TIMER32_0, 0);

 

    Chip_TIMER_SetMatch(LPC_TIMER32_0, 0, SystemCoreClock*10);
    Chip_TIMER_ExtMatchControlSet(LPC_TIMER32_0, 0, TIMER_EXTMATCH_SET, 0);

 

      //SLEEP
     Chip_SYSCTL_SetDeepSleepPD(SYSCTL_DEEPSLP_BOD_PD);
     Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_IRCOUT_PD | SYSCTL_POWERDOWN_IRC_PD |                                                       SYSCTL_POWERDOWN_BOD_PD | SYSCTL_POWERDOWN_ADC_PD |                                                       SYSCTL_POWERDOWN_SYSOSC_PD | SYSCTL_POWERDOWN_SYSPLL_PD |                                                       SYSCTL_POWERDOWN_USBPLL_PD | SYSCTL_POWERDOWN_USBPAD_PD);
     Chip_SYSCTL_SetWakeup((uint32_t)~(SYSCTL_POWERDOWN_FLASH_PD |                                                                     SYSCTL_POWERDOWN_WDTOSC_PD));

    Chip_TIMER_Enable(LPC_TIMER32_0);

while (1) {
    Chip_PMU_DeepSleepState(LPC_PMU);
}

 

thank you very much for your help

Outcomes