11 Replies Latest reply on Dec 23, 2018 8:47 PM by BragadeeshV_41

    psoc4/IIC data error

    LeLi_3670906

      Hi all,


      When I use iic to make psoc4(slave) communicate with main chip(stm32f072)main chip receive iic buffer from psoc4

      When I touch button(such as 7),received data is rightbut when I release my finger the received data (version number is 2 but received 1 ) is wrong

      Could you please  give me some suggestionthanks

      My iic buffer received data as below

        • 1. Re: psoc4/IIC data error
          BragadeeshV_41

          Hi,

           

          Could you please let me know what data you are trying to read from the PSoC device?

           

          Is it possible for you to share your project file focusing on the issue?

           

          Regards,

          Bragadeesh

          • 2. Re: psoc4/IIC data error
            LeLi_3670906

            Hi Bragadeesh,

             

            As you can see in this project attached,3 bytes of iic buffer are the data that master want to read.

            Thank you for your focus.

             

             

            Best regards,

            Leo

            • 3. Re: psoc4/IIC data error
              BragadeeshV_41

              Hi Leo,

               

              I ran your code in our PSoC 4000 kit and the code is working as expected. I used the BCP as the master to read the I2C buffer and below is the screenshot from BCP

               

              Could you please give me more information on when you see this happening so that I will try to reproduce it from my side.

               

              Also, there is no assignment to MyI2C_Regs.Version=0x01 in your code. Just check if you have written 1 to this version element in the buffer from the master by mistake.

               

              Let me know the master command you are using to read from our slave.

               

              Regards,

              Bragadeesh

              • 4. Re: psoc4/IIC data error
                LeLi_3670906

                Hi Bragadeesh,

                 

                I used the BCP as the master to read the I2C buffer ,the data aslo is right.

                 

                But the main chip(stm32f072) as the master to read the I2C buffer,There are two kinds of outcomes:

                1.When I touch button,received data is right;

                2.When I release my finger ,the received data version in most cases is 2,sometimes is 1。

                 

                In my code,i have not written 1 to this version element .

                 

                My i2c read command is standard i2c read functions.

                I guess if low power mode cause it?When I read i2c data, do I need to wake up the chip by reading it empty twice?

                 

                 

                Best Regards,

                Leo

                 

                • 5. Re: psoc4/IIC data error
                  LeLi_3670906

                  Hi Bragadeesh ,

                   

                  Also,when I use debug mode in psoc creator ide,I set a breakpoint as below.

                  The program can still go here without fingers close to.

                  But I have debug to the appropriate sensitivity in tuner mode.

                  I have a question :The Proximity threshold is set to 90,but status is still not 1 when my finger close to it,only touch it the status is 1.

                  So how to judge validity of approaching.

                   

                   

                   

                  Thanks,

                  Leo

                  • 6. Re: psoc4/IIC data error
                    BragadeeshV_41

                    Hi Leo,

                     

                    Can you please send scope shots of the bus so that we can find out what's actually happening in the transactions?

                     

                    Regards

                    Bragadeesh

                    • 7. Re: psoc4/IIC data error
                      BragadeeshV_41

                      Hi,

                       

                      The sensor status will be 1 only if the Difference Count is greater than Finger Threshold + Hysteresis. What is the hysteresis parameter you have set?

                       

                      What is the proximity distance you're expecting? Place your hand at the distance you are expecting and make sure you get the difference count of at least 50 ( and SNR of 5:1). Now set your thresholds as given in the table below:

                       

                      Regards,
                      Bragadeesh

                      • 8. Re: psoc4/IIC data error
                        LeLi_3670906

                        Hi Bragadeesh,

                         

                        Scope shots attached,Please help to analyze them。

                         

                         

                        Thanks,

                        Leo !

                        • 9. Re: psoc4/IIC data error
                          BragadeeshV_41

                          Hi Leo,

                           

                          Upon analyzing your waveform I can find the following:

                           

                          1. In the no touch image, I find that the slave has nacked the data byte which might be due to the device waking up from deep sleep.

                          2. Also the next byte sent by the slave (Version - 0x02) is right. Please check that in your no touch image. So this is not the issue with the PSoC slave. It might be due to the master sampling this data at the wrong places. Maybe this is due to the high data rate. Can you make your data rate as low as possible (say 50) and check if you see this issue

                          3. Also you mentioned you see this issue rarely and not often, then increase your data rate as high as possible and let me know if you see this issue more often than before.

                          4. Could you please let me know the rise time, fall time , data hold time, low period of SCL Clock and high period of SCL clock

                           

                          Regards,

                          Bragadeesh

                          • 10. Re: psoc4/IIC data error
                            LeLi_3670906

                            Hi Bragadeesh,

                             

                            I'm sorry to reply you so late,because I have been busy recently。

                             

                            When I deleted sleep mode,the version number from I2C buffer is always right。

                             

                            But I need sleep mode,so what can I do for it?

                            • 11. Re: psoc4/IIC data error
                              BragadeeshV_41

                              Hi,

                               

                              If sleep mode is the issue, then you can send dummy bytes to the slave and wake up the device and send a read command only when the device is awake, ie the slave has acked your last transaction. Try this and post your results.

                               

                              Regards,

                              Bragadeesh