3 Replies Latest reply on Dec 27, 2012 5:00 AM by JoMe_264151

    Corrupt i2c data

      Hello All,


      I am using psoc as slave with i2c read buffer of size 8 byte. Master polls psoc in every 100ms.


      Very frequently on i2c analyzer i am getting all 8 byte with 0xFF data with i2c Control/Status register I2CHW_RD_ OVERFLOW bit set.


      As per my understanding this may cause because of either


      1. doing capsesense scan in mainloop() .


      2. enabling disabling global interrupt in mainloop().


      have anyone faced similar problem before?


      Thanks in advance.

        • 1. Re: Corrupt i2c data

          Usually I2C runs without any problems interrupt driven.


          Polling for a message every 100ms (10 times a second) may lead to an error when two messages appear a bit too fast.


          The CapSense module uses an interrupt only at the end of a scanning of all sensors, this usually does not interfere with I2C.


          A cause of errors might be the pull-up resistors.


          Did you check beforehand by disabling the CapSense whether the I2C implementation runs error-free?


          You may always post your project here for us all to have a look at.


          To do so: in Creator


          Build -> Clean Project


          File -> Create Workspace Bundle (minimal)


          and finally upload your project here preferrably using MS Internet Explorer (Chrome sometimes doesn't work)







          • 2. Re: Corrupt i2c data

            Hi Bob,




            thanks for quick replay.


            After disabling capsense scan i2c run error free.     I have narrowed down problem to line of code




             or      reg[PWM_CR], 0x01                       ; Start Dedicated PWM




                mov     A, [CSD_bADCStatus]


                ;jz      .L1


             Of Routine CSD_ScanSensor: (csd.asm line:713 ).








            If we temporary comment these 4 lines we do not see this data corruption issue. However capsense does not work. Is register A is shared between i2c read operation and capsense? Can we use any other register(X) apart from A?





            • 3. Re: Corrupt i2c data

              What you are pointing at is a short loop where the program is waiting for an analog-to-digital conversion becomes ready. This is not interrupt driven, but the program will wait here until it IS ready. Any interrupt (i.e. I2C) will be executed here as far as interrupts are enabled within this loop. The issue surely has nothing to do with the register A used here, that is quite common used in the 8051 core.


              I think it is the time (if you may) to upload your complete project here so that we can check all the properties and logic.


              To do so, use the "Create Workspace Bundle" (minimal) in Creator and upload the resulting .Zip here. (Use MS Internet Explorer, Chrome may fail to upload)