-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[i2c] MLX90614 #1694
Comments
@andriyadi which version are you using? RC3, RC4, Release 1.0.0, or Github direct? Try this test code: #declare SLAVEADDR 0x5A
void setup(){
Serial.begin(115200);
Wire.begin();
Wire.beginTransmission(SLAVEADDR);
Wire.write((uint8_t)0);
uint8_t err = Wire.endTransmission(false);
if(err !=7) {
Serial.printf("Setting Eeprom read to address 0 failed =%d(%s).\n",Wire.lastError(),Wire.getErrorText(Wire.lastError)));
}
uint8_t count = Wire.requestFrom(SLAVEADDR,64);// 32 address 16bits each so 64 bytes
if( count != 64 ){
Serial.printf("Reading Eeprom data failed =%d(%s). Only read %bytes.\n",Wire.lastError(),Wire.getErrorText(Wire.lastError)),count);
}
uint16_t a=0; // eeprom address register
while (Wire.available()){
uint16_t b,c;
b = Wire.read();
c = Wire.read();
b = b | (c << 8);
Serial.printf("0x%02: 0x%02X\n", a++, b);
}
Serial.println(" all done");
}
void loop(){} Chuck. |
Thanks for your reply @stickbreaker Will get the Release 1.0.0 and try your suggested code. |
Hi @stickbreaker
The output is:
|
Interestingly, I tried your older code (the one before merging, I attach them here), I can communicate properly with the MLX90614 sensor and it returns expected result. As for running your test code, I got this:
The first two |
In fact, I also tried to use your code in your repo of July 2 version, it also works well. I can communicate the sensor properly. Please kindly advice. |
Can you set core debug level to Verbose I'll look through the read code and see if i can find anything. Chuck |
I don't know whether it's meaningful to you. Here's what I got @stickbreaker :
|
Thats great, now i have something, |
@andriyadi found the problem, working through the fix, and TEST it! Chuck. |
@andriyadi try this fix; substitute this file for: (on a window 7 pro, Arduino 1.8.5)
The fault it mine, I updated the I2C core to fix an interrupt saturation problem, I missed the ReSTART case. Sorry. It works for me but I have not thoroughly tested it. I need some more testing before I create a pr. Chuck. |
Hi @stickbreaker Few things I've found:
Data are read successfully, but I think you may want to know. Thanks for awesome fix! |
@andriyadi that error is bus_busy, read the data sheet on your acc, it looks like the sensor is stretching SCL to indicate it is busy. I'll look over it. Chuck. |
@andriyadi posted a new pull #1717. It changes all 4 files of the i2c subsystem. You might try it by swapping these four files with the release version. Chuck. |
@stickbreaker thanks for the fix and sorry late response. I've put few comments on PR #1717 |
Fixed on #1717 =) |
Hello, I am getting all registers are FFFF while accessing MLX90614 over I2C 12:21:53.108 -> 0 = FFFF so what can be the issue for that? |
I have changed line 25 in Adafruit_mlx90614.h to
The original address was 0x5A it seems the mlx90614 is on address 0x0E
|
Hardware:
Board: Custom board
Core Installation/update date: Latest master
IDE: esp-idf with Arduino as component
Description:
I'm having issue with MLX90614 sensor. Using latest core and this Arduino code, it doesn't work anymore. If using previously I2C, before @stickbreaker I2C code merged to master, it all works fine on the very same board. So, the issue is clearly not hardware.
What I meant by "doesn't work" is that the data returned by Wire.read() never be right. Using previous I2C code, it return expected values.
I've tried two libs:
https://github.com/adafruit/Adafruit-MLX90614-Library
https://github.com/sparkfun/SparkFun_MLX90614_Arduino_Library
both not working.
Sketch:
Using examples on both libraries
What I did:
Tried to change clock varying from 10KHz to 100KHz doesn't help (the sensor supports that range). Also changing timeout doesn't help.
Tried to change Adafruit's library to this:
Always return
Cnt: 3, ret: 0x0, pec: 0x0, reg: 0x7
Meaning
ret
is always zero.Please kindly advice. Thanks.
The text was updated successfully, but these errors were encountered: