5 Replies Latest reply on Jul 21, 2016 11:33 PM by user_1377889

    PSoC4 half high level output?

    yang.zhou

      Hi:

         

        I use Cy8C4124 as an I2C slave device. if master don't read anything after 30 secounds. CY8C4124 will go to stop mode.most times are fine but some times, i find all of output pin of CY8C4124 is high level output. it is not 3.3V, but is 1.7V.

         

        I don't know why. please help me. thank you very much.

         

      my code you can see below:

         

      int main()
      {
          
          CySysPmUnfreezeIo();
          CyGlobalIntEnable; /* Enable global interrupts. */

         

          I2CM_Start();
          EZI2C_EzI2CSetBuffer1(BUFFER_SIZE, READ_ONLY_OFFSET, ezI2cBuffer);
          EZI2C_Start();

         

          ReadfromBattary();
          
          Test_Write(1);
          CyDelay(10);
          Test_Write(0);
          CyDelay(1000);
          Test_Write(1);
          
          Timer_1_Start();
          TimerISR_StartEx(timer_isr); // Do use this one! 
          /* Place your initialization/startup code here (e.g. MyInst_Start()) */

         

          while(1)
          {}
      }

         

      void TimerISR( void )
      {
          sleepcount++;
          if(timecount>=500000)
          {
          timecount=0;
          Test_Write(1);    
          ReadfromBattary();   
          }
          else
          {
          timecount++;
          read_flag=0;  
          Test1_Write(0);  
          Test_Write(0);
          }
          if(sleepcount>=5000000)
          {
          sleepcount=0;

         

          I2CM_Stop();    
          EZI2C_Stop();    
          Timer_1_Stop();
          
          CySysPmSetWakeupPolarity(CY_PM_STOP_WAKEUP_ACTIVE_HIGH); 
          
          CySysPmStop();

         


          }
          
      }

        • 1. Re: PSoC4 half high level output?
          user_1377889

          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.

             

           

             

          Bob

          • 2. Re: PSoC4 half high level output?
            yang.zhou

            Hi Bob:
              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.

            • 3. Re: PSoC4 half high level output?
              user_202255621

              I did try PSOC4 and PSOC5 for I2C, use PSOC5 is more easy and less problem.

              • 4. Re: PSoC4 half high level output?
                yang.zhou

                OK,i choose PSoC4 because i use it in a battery and i need low power fuction.

                • 5. Re: PSoC4 half high level output?
                  user_1377889

                  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)

                     

                   

                     

                  Bob