You are here

Corrupt i2c data | Cypress Semiconductor

Corrupt i2c data

Summary: 3 Replies, Latest post by Bob Marlowe on 27 Dec 2012 05:00 AM PST
Verified Answers: 0
Last post
Log in to post new comments.
tkgrahul's picture
User
13 posts

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.

 

 

user_1377889's picture
User
10803 posts

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)

 

 

Bob

tkgrahul's picture
User
13 posts

Hi Bob,

 

thanks for quick replay.

After disabling capsense scan i2c run error free.

Normal
0

false
false
false

EN-US
X-NONE
X-NONE

MicrosoftInternetExplorer4

I have narrowed down problem to line of code

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

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

;.L1:

    mov     A, [CSD_bADCStatus]

    ;jz      .L1

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

Normal
0

false
false
false

EN-US
X-NONE
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

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?

 

Thanks,

 

user_1377889's picture
User
10803 posts

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)

 

Bob

Log in to post new comments.