Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Thank you for your relay. attachment is my code.
In this project, there is an I2C master device.it reads battery information(speed is 100K) every 2 seconds and output a high level plus at P2.0.and an I2C slave device for store the battery information(speed is 400K).
i have another MCU(Cy8C3245),in normal operation, it will read from Cy8C4124 by I2C every 2 seconds. if it doesn't any operate in 28 seconds, the Cy8C4124 will go to stop mode.
if re-connect the i2c communication again. the Cy8C4124 will wake up.
my problem is sometimes when i re-connect the i2c communication. the Cy8C4124 will wake up is OK. but all pin output level is a half high level.
Workspace01_2.zip 2.9 MB
I did try PSOC4 and PSOC5 for I2C, use PSOC5 is more easy and less problem.
OK,i choose PSoC4 because i use it in a battery and i need low power fuction.
You do not clear the Timer_1 interrupt. Read the section of the TCPWM for the interrupt output, explained pretty clearly on page 6.
Your interrupt handler is quite lengthy, you are transmitting data via i2c which involves other interrupts and which takes a comparably very long time. Your monitored behave of the pins might be due to the fact that the outputs are high-z and hence floating to any value.
I would suggest you to change your interrupt handler to
Clear the interrupt
Set a global volatile(!!) flag to indicate interrupt has occured. Of course you may maintain your counters within the handler and use the values instead of the flag.
In main() in your main-loop
Check for the flag (or the counters ) and act accordingly
Shut down all peripherals (using the _Sleep() function when changing to deep sleep)
Go to Sleep (Deep Sleep mode could save more power but works differently)