melexis / mlx90640-library

MLX90640 library functions
Apache License 2.0
241 stars 192 forks source link

Reading Random Data from EEPROM #102

Closed Sasasu closed 1 year ago

Sasasu commented 1 year ago

I have an MLX90640, but I'm always reading completely random data from the EEPROM.

I'm using RP2040 and Nuttx to read the MLX90640, and the code I'm using can be found at https://github.com/Sasasu/nuttx-apps/commit/612218f89df881612e96bd552f3222baf246b309.

The I2C frequency when reading the EEPROM is 50kHz.

There are 2K pull-up resistors on the SCL and SDA lines of the I2C, and the signal quality captured with an oscilloscope is shown in the image.

2023-03-18_23-47

The logic analyzer shows that the data received by the MCU is the same as the data on the line.

image

Here are a few of the results I've obtained from multiple reads, which are completely different from each other.

1: 0x3E, 0x81, 0x5C, 0xF0, 0x6F, 0x00, 0x38, 0x1D, 0x46, 0x9A, 0x11, 0x79, 0x21, 0x28, 0x41, 0xEF, 0x5E, 0xB6 2: 0x49, 0xCE, 0x0B, 0x36, 0x26, 0xA8, 0x41, 0x3B, 0x2B, 0x86, 0x06, 0xD2, 0x4C, 0xE8, 0x3D, 0x61, 0x59, 0x58 3: 0x42, 0x73, 0x1D, 0xC8, 0x16, 0xAA, 0x45, 0xA0, 0x36, 0x32, 0x74, 0xCA, 0x59, 0x58, 0x3E, 0xC5, 0x31, 0x5B 4: 0x39, 0x66, 0x6E, 0x87, 0x5E, 0xD8, 0x3E, 0x11, 0x50, 0xF2, 0x7F, 0x06, 0x2F, 0xE0, 0x41, 0x93, 0x17, 0xC8 5: 0x63, 0x1E, 0x68, 0x38, 0x3B, 0xE0, 0x49, 0x62, 0x0A, 0x02, 0x27, 0x58, 0x41, 0xD8, 0x2A, 0x0B, 0x0A, 0xCC 6: 0x2B, 0x28, 0x41, 0xC7, 0x26, 0x52, 0x0C, 0x2A, 0x49, 0xBC, 0x3A, 0xA7, 0x6A, 0x1E, 0x61, 0x2A, 0x65, 0x06

read data.zip

the device ID is OAB2377801


I believe this is not normal. Are there any possible reasons for this issue?

Sasasu commented 1 year ago

image

I think this is not a signal quality issue. this should be a typical I2C waveform

Sasasu commented 1 year ago

image

There is a 0.5ms wait time after the first 16bit read, and then a 0.13ms wait time for the next two 16bits. The next 4 have a 0.05ms wait time. Then the cycle starts again.

Is this EEPROM read delay normal? I think this is normal...

Sasasu commented 1 year ago

image

I am trying to read the I2C address config register and EEPROM. MLX90640 is responding at 0x33, but the register shows the address is 0x18, EEPROM shows the address is 0xFF.

so there still is a wire problem

Sasasu commented 1 year ago

https://github.com/Sasasu/nuttx-apps/commit/7d85b7d6c406dc9dca378f9c2c04a1ff7a5f8a4a

mlx90640 is using big endian