06-06-2018 08:33 PM
Hello, I'm using the NI-9402 as an I2C to communicate to a sensor. Although I am able to successfully write to and read from the sensor, there are runs where the sensor data are shifted. Here are more information of my system and error:
Any idea what I could try? Thanks.
Solved! Go to Solution.
06-07-2018 04:50 PM
Hey,
I do have a few questions in regards to your application:
1. What sensor are you using?
2. Are you able to scope the output of your slave device to see if that matches the values you are getting in LabVIEW?
Thanks,
-Brian J.
06-07-2018 04:51 PM - edited 06-07-2018 04:52 PM
Hi Brian,
I'm using the MC3672 accelerometer. Yes, I'm able to scope the I2C lines and verify that the readings from the sensor are correct. As mentioned, sometimes Labview report the correct readings; sometimes, Labview reports a shifted reading.
06-13-2018 08:42 PM
Hello,
So my issue with the 9402/9039 seems to be fixed until I changed its code today.
Yesterday, I wrote some code for the I2C 9402 and my MC3672 sensors.
Today, I slightly changed my 9402 code to include a two byte write in a while loop.
I added an image to show the two different 9402 codes. Hopefully somebody can pick out what I'm doing wrong. Thanks.
06-14-2018 08:25 PM
Hello, I still haven't solved my problem. But I noticed today that I duplicated the code 4x (because I have 4 sensors), and the output shifts differently for sensor #1 versus the other sensors. This leads me to think that it's not the Labview code but something in the FPGA (cRIO 9039). Any thought?
06-15-2018 06:08 PM - edited 06-15-2018 06:09 PM
Do you observe this behavior even if you do not read from register 6 (i.e. just read from 5 registers)? What is the value of the "Read Register Start"?
06-15-2018 06:59 PM
Hello, the value of the "Read Register Start" is 0x02.
Yes, I do observe this issue even if I was reading from 5 registers, or even 1 register. And this issue also occurred even if my "Read Register Start" is not 0x02.
06-18-2018 06:03 PM
Do you have a manual for the I2C commands?
As a workaround, you could do some array manipulation to change the order you are reading so you actually read in the correct order. It seems that the FPGA Reset keeps the "shifting" behavior consistent.
06-19-2018 03:21 PM
Hi Brian,
What do you mean by I2C manuals?
I am currently accepting this "output shift" bug and routing my outputs to the plots accordingly. Luckily, the FPGA RESET allows the shift to be consistent every time I run the code, so for now, this will be the solution to this bug.
06-19-2018 03:24 PM
By the way, Brian, one of my NI-9402 CH0 just totally died yesterday. CH0 is consistently outputting 0, and when I scoped the I2C lines, I don't see anything. I swapped CH0 and with CH1, and I do see I2C communication on CH1 but not CH0, which means my sensor is OK, but something is wrong with the 9402's CH0. Should I open another ticket to look into this, or how should I debug?
Thanks.