필터 지우기
필터 지우기

Raspberry Pi I2C readRegister returning spurrious values

조회 수: 2 (최근 30일)
Nathan
Nathan 2015년 7월 28일
댓글: Nathan 2015년 8월 3일
Have connected a ADR5593R to a Raspberry Pi and am able to see it on the I2C bus but when i try to read any register i get a random number which does not agree with that registers default value. This number is the same for all registers but changes if i reset the chip. Code I am using is:
mypi=raspi;
writeDigitalPin(mypi,23,1) %connected to the chip's reset pin
adc= i2cdev(mypi,'i2c-1','0x11');
[value]=readRegister(adc,3,'uint16');
Am i using the readRegister command incorrectly?

답변 (1개)

Sumit Tiwari
Sumit Tiwari 2015년 7월 31일
Hi Nathan,
It is my understanding that you are trying to read data from your sensor/converter using the I2C protocol.
Unfortunately, without the specifics of your design, it is very hard to pinpoint where things are going wrong. But one way to ensure the correctness of your design would be to gather the data from these registers yourself (using a Linux shell terminal), and compare it with the results you see in MATLAB.
To do so, you first need to install the 'i2c-tools' package on your board and load its driver module. You can follow the instructions here to do so here: http://skpang.co.uk/blog/archives/575
Once the 'ic2-tools' package is installed, you can use its utilities to read and write data using your I2C bus. In your case, to read data from one of the chip registers, you would have to issue the 'i2cget' command appropriately. As an example, for a device connected at /dev/i2c-1 at address 0x49, to read a word from the currently selected register you would have to issue the following in your terminal:
i2cget -y 1 0x49 0 w
Further information on the 'i2cget' command can be found here: http://www.lm-sensors.org/wiki/man/i2cget
Once you obtain results by directly probing the Pi, you should be able to figure out any issues by comparing them with the results from MATLAB.
I hope this helps; feel free to post your results here.
Best,
Sumit
  댓글 수: 1
Nathan
Nathan 2015년 8월 3일
We have done this and found the behaviour to be exactly the same as in Matlab, we also tried with an Arduino and got the same behaviour so i think the problem might lie with the chip or with the I2C lines as it seems to respond fine to address changes and resets etc. What specifics is it that you require exactly? Currently the chip is sat on a breadboard with the Vref, Vlogic and Vdd driven from the Pi's 3.3V out, GND, SCL and SDA connected to their relevant pins on the Pi (6, 5 and 3 respectively) and the Reset pin is connected to 23.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Run on Target Hardware에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by