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)
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]
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?
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)