I2C bus strange behavior
I am trying to read the I2C pressure sensor [MS4515DO].The sensor is connected to P28&29.
I am able to read the out-put from the sensor.The issue is the readings I get depends in the order how I power up the propeller.
If connect the USB to the prop board("SpinStudio") and then switch on the power to the board - The readings I observe is from 223 - 255.If I reset using
the reset button it still reads 223-255.
When I turn off the power to the "SpinStudio" board the readings observed is 32 - 62.
I can repeat this as many times with the same result.
Attached are 1. Code use to read the -pressure sensor - > MS4515DO
2.MS4515 Data sheet
3.The I2C Object
I am able to read the out-put from the sensor.The issue is the readings I get depends in the order how I power up the propeller.
If connect the USB to the prop board("SpinStudio") and then switch on the power to the board - The readings I observe is from 223 - 255.If I reset using
the reset button it still reads 223-255.
When I turn off the power to the "SpinStudio" board the readings observed is 32 - 62.
I can repeat this as many times with the same result.
Attached are 1. Code use to read the -pressure sensor - > MS4515DO
2.MS4515 Data sheet
3.The I2C Object
Comments
If it's a bus loading problem, you may need to add pullups to SCL and SDA. Try 4.7K first.
Thank you for your quick reply.
I am sorry I forgot to mention that I already had pull-ups on both SCl&SDA as suggested in the data sheet.
I also tried using the attached code too - with the same results.I will try changing the timing to slow down the pasm code.
The SPIN I2C though should be slow enough to make that almost a moot issue unless it takes the thing ages to ACK.... so hmmm.
I altered the pasm_i2c_driver to run open collector, and always check that SCL has indeed been pulled back up to 1 before calling it an ACK/NAK for devices that stretch the clock.
I just received a " Easy I2C - protocol Analyzer" and I ran it through.
I have attached the reports - They look good to me - but I am no expert so please look at them
and let me know if there is any problems.
Wait though.... looking at the data sheet, don't you first have to do a |START|RD_ADDR|STOP| to tell the device to sample? Then you can read the measurement in one of 3 ways? You then have to start a second transaction |START|RD_ADDR|DATA+ACK|DATA+NAK|STOP| to get the reading. Am I reading that wrong?
The data I sent from the I2C protocol analyzer - do change,the problem was it was sampling so fast and it would take many pages to catch them.I tried to cacth them
as you would notice in one or two of the captured results.I can display the reading changes using PST as the pressure is increased/decreasd.So the slave I2C does function but the readings are 31 to 63 and 233 to 255
depending on how power was applied as explained in the first posting.
Your I2C communication looks right from the capture. Is it the "Low Power" version? (ends in L)? If it's not low power then I take it that it should be continually converting within the 500uS response time.
Check the voltages supplying the chip in both power conditions? Otherwise I don't know. Seems to be reasonable data either way if you mask out the status bits.
Thank you very much for all the help.