lpcware

I2C Slave pulls SDA and SCL Pins low when entering Power Down mode

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by skywalk on Mon Feb 10 09:14:53 MST 2014
I try to test LPC812 power modes and use the LPCXpresso LPC812 Board and the NXP AN11332-Software together with LPCXpresso 6.1.4.

AN11332 Code works until the Device goes to "Power-Down" mode (not Deep-Power-Down).

At this moment, the SDA and SCL pins go low (~0.5 Vdc) voltage.
That disables all other I2C Traffic on the bus and the LPC will never get its Address for waking from Power-Down.
This would make the "wake from I2C" unsuable.

As far as i understand the AN11332 Code, it should work fine; the configuration seems to be OK.

Has somebody used the LPC812 I2C as an Slave and configured it for Power-Down?


/*connect the I2C SCL and SDA sigals to port pins(P0.10-P0.11)*/
regVal = LPC_SWM ->PINASSIGN7 & ~(0xFFUL << 24);
LPC_SWM ->PINASSIGN7 = regVal | (10 << 24); /* P0.10 is I2C SDA, ASSIGN0(31:24) */
regVal = LPC_SWM ->PINASSIGN8 & ~(0xFF << 0);
LPC_SWM ->PINASSIGN8 = regVal | (11 << 0); /* P0.11 is I2C SCL. ASSIGN0(7:0) */

LPC_SYSCON ->CLKOUTDIV = 120; /* CLKOUT = 60E6 / 120 = 500 kHz */
LPC_SYSCON ->CLKOUTSEL = 0x03; /* CLKOUT = Main clock */
LPC_SYSCON ->CLKOUTUEN = 0x01; /* Update CLKOUT Source      */

LPC_GPIO_PORT ->DIR0 |= (1 << 5);
regVal = LPC_SWM ->PINASSIGN8 & ~(0xFF << 16);
LPC_SWM ->PINASSIGN8 = regVal | (0x0F << 16); /* P0.15 is CLKOUT. ASSIGN8(23:16) */

LPC_GPIO_PORT ->DIR0 |= (1 << 7);
SysTick_Config(SystemCoreClock / 2);

/* Enable I2C clock */
LPC_SYSCON ->SYSAHBCLKCTRL |= (1 << 5);
/* Toggle peripheral reset control to I2C, a "1" bring it out of reset. */
LPC_SYSCON ->PRESETCTRL &= ~(0x1 << 6);
LPC_SYSCON ->PRESETCTRL |= (0x1 << 6);

I2C_SlvInit(LPC_I2C, SLAVE_ADDR, CFG_SLVENA, I2C_FMODE_PRE_DIV);
/* Ready to receive the slave address, interrupt(SLAVE ADDR STATE) if match occurs. */
LPC_I2C ->SLVCTL = CTL_SLVCONTINUE;
LPC_I2C ->INTENSET = STAT_SLVPEND;

/* Enable wake from power down using I2C */
LPC_SYSCON ->STARTERP1 |= (1 << 8);




/*****************************************************************************
** Function name:PMU_Sleep
**
** Descriptions:Put some of the peripheral in sleep mode.
**
** parameters:SleepMode: 2 is power down, 1 is deep sleep, 0 is sleep, Sleep peripheral module(s)
** Returned value:None
**
*****************************************************************************/
void PMU_Sleep( uint32_t SleepMode, uint32_t SleepCtrl )
{
  LPC_SYSCON->PDAWAKECFG = LPC_SYSCON->PDRUNCFG;
  LPC_SYSCON->PDSLEEPCFG = SleepCtrl;
  /* If normal sleep, not deep sleep, don't do anything to SCR reg. */
  switch ( SleepMode )
  {
case MCU_POWER_DOWN:
  SCB->SCR |= NVIC_LP_SLEEPDEEP;
#if __WKT
  LPC_PMU->DPDCTRL |= (0x1 << 2);
  init_wkt(1, 10000 * 10);
#endif
#if 1
  LPC_PMU->PCON = 0x2;
#else
  LPC_SYSCON->PDSLEEPCFG &= 0xFDFF;
#endif
  break;
case MCU_DEEP_SLEEP:
  SCB->SCR |= NVIC_LP_SLEEPDEEP;
#if __WKT
  LPC_PMU->DPDCTRL |= (0x1 << 2);
  init_wkt(1, 10000 * 10);
#endif
#if 1
  LPC_PMU->PCON = 0x1;
#else
  LPC_SYSCON->PDSLEEPCFG &= 0xEFF9;
#endif
  break;
case MCU_SLEEP:
default:
  break;
  }
  __WFI();
  return;
}


Outcomes