2 Replies Latest reply on Apr 6, 2011 10:20 AM by udayan.umapathi

    I2C Wake feature on ES3 is not working

    user_10802449

      Hi, I am having trouble testing the I2C Wake feature using an ES3 CY8C3866.  The basic read and write slave functionality works fine but it does not wake up.  I cannot figure out if I am missing anything.  Can anyone help?  I am listing the hardware setup and source for a basic I2C Slave.  Thanks.

         

       

         

      The hardware is setup as follows:

         

      Mode: Slave
      Data Rate: 100 kps
      Implementation: Fixed Function
      Address Decode: Hardware
      Slave Address: 0x3F
      Pin Connections: I2C0
      Enable wakeup from Sleep Mode: Yes.

         

      Pin settings:
      Input: Bidirectional, OpenDrain Low, Input Buffer Enabled, Input Synchronized
      Output: Fast, Vddio, 4mA source/ 8mA sink, Output Synchronized

         

       

         

      Source:

         

       

         

      #include <device.h>

         

      uint8 I2CReadBuffer[128];
      uint8 I2CWriteBuffer[128];
      uint8 cloopCount;

         

      void main()
      {
          /* Place your initialization/startup code here (e.g. MyInst_Start()) */
          I2C_Start();
          I2C_EnableInt(); 
          LED_Write(0);

         

          I2C_SlaveInitWriteBuf( &I2CWriteBuffer, 128);
          I2C_SlaveInitReadBuf( &I2CReadBuffer, 128 );

         

          CYGlobalIntEnable; /* Uncomment this line to enable global interrupts.*/ 

         

          for(;;)
          {
              if ( I2C_SlaveStatus() & I2C_SSTAT_WR_CMPT )
              {
                  for ( cloopCount = 0; cloopCount < I2C_SlaveGetWriteBufSize(); cloopCount++ )
                  {
                      I2CReadBuffer[cloopCount] = I2CWriteBuffer[cloopCount];
                  }
                  I2C_SlaveClearWriteStatus();
                  I2C_SlaveClearWriteBuf();
              }

         

              if ( I2C_SlaveStatus() & I2C_SSTAT_RD_CMPT )
              {
                  I2C_SlaveClearReadStatus();
                  I2C_SlaveClearReadBuf();
              }
              if ( I2CWriteBuffer[0] == 0x24 )
              {
                  LED_Write(1);
                  I2C_Sleep();
                  CyPmSaveClocks();
                  CyPmSleep(PM_SLEEP_TIME_NONE, PM_SLEEP_SRC_I2C);
                  CyPmRestoreClocks();
                  I2C_Wakeup();
                  LED_Write(0);
                  I2CWriteBuffer[0] == 0;
              }
          }
      }

        • 1. Re: I2C Wake feature on ES3 is not working
          user_10802449

           Nvm, I found the problem.  It was my mistake.  With the following.  Thanks anyway.

             

              "I2CWriteBuffer[0] == 0;"

          • 2. Re: I2C Wake feature on ES3 is not working
            udayan.umapathi

            Things to be made sure to use I2C Sleep wake up on PSoC3,

               
                  
            • The I2C pin used should be either I2C0 or I2C1. I2C0 is the pair, and I2C1 is the pair.
            •     
            • The Wakeup on address match parameter should be enabled.
            •     
            • I2C should be set as the source of wake up before entering sleep.
            •     
            • In addition to this, the I2C component should be prepared for sleep mode operation before the devcie is put to sleep, the same can be done using the API, "I2C_Sleep()". After device comes out of sleep, the component active mode configuration has to be restored using the API, "I2C_RestoreConfig()".
            •    
               

            Note: I2C Sleep Wakeup functionality is available only on PSoC2 ES3 revision and later.

               

             

               

            -U2