You are here

I2C Wake feature on ES3 is not working | Cypress Semiconductor

I2C Wake feature on ES3 is not working

Summary: 2 Replies, Latest post by U2 on 06 Apr 2011 10:20 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
dchung's picture
User
27 posts

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;
        }
    }
}

dchung's picture
User
27 posts

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

    "I2CWriteBuffer[0] == 0;"

U2
uday's picture
Cypress Employee
569 posts

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

Log in to post new comments.