AnsweredAssumed Answered

S12ZVC Watchdog and I2C Problem.

Question asked by Seung-Tae Ryu on Feb 4, 2016
Latest reply on Feb 23, 2016 by Radek Sestak

I2C is not work when internal watchdog(COP) enable.

Could you tell me how to clear this problem?

 

* Watchdong Setting -

  /* ###  WatchDog "WDog1" init code ... */

  /* CPMUPROT: ??=0,??=0,??=1,??=0,??=0,??=1,??=1,PROT=0 */

  setReg8(CPMUPROT, 0x26U);            /* Disable protection of clock-source register */

  /* CPMUCLKS: CSAD=0,PCE=0,COPOSCSEL0=1 */

  clrSetReg8Bits(CPMUCLKS, 0x24U, 0x01U);

  /* CPMUPROT: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,PROT=0 */

  setReg8(CPMUPROT, 0x00U);            /* Re-Enable protection of clock-source register */

  /* CPMURFLG: COPRF=0 */

  setReg8(CPMURFLG, 0x00U);            /* Clear COP reset flag */

  /* CPMUCOP: WCOP=0,CR2=1,CR1=0,CR0=0 */

  clrSetReg8Bits(CPMUCOP, 0x83U, 0x04U);

 

* I2C Setting

/* IIC0IBCR: IBEN=0,IBIE=0,MS_SL=0,TX_RX=0,TXAK=0,RSTA=0,??=0,IBSWAI=0 */

IIC0IBCR = 0U;                       /* Clear control register */

I2C_SerFlag = 0x80U;                 /* Reset all flags */

I2C_SlaveAddr = 0x10U;               /* Set variable for slave address */

/* IIC0IBFD: IBC7=0,IBC6=1,IBC5=0,IBC4=1,IBC3=0,IBC2=1,IBC1=0,IBC0=0 */

IIC0IBFD = 0x54U;                    /* Set prescaler bits */

IIC0IBCR_IBEN = 1U;                  /* Enable device */

/* IIC0IBCR: IBEN=1,IBIE=1,MS_SL=0,TX_RX=0,TXAK=0,RSTA=0,??=0,IBSWAI=0 */

IIC0IBCR = 0xC0U;                    /* Control register settings */

Outcomes