Understand the extra work this takes.
Just out of interest I have connected an MLX90615 that I have around. It has similar specifications to the MLX90614 but not completely the same and different register addresses. BUT they are part of the same family and design. Their interface is very much the same.
Now the fun part.. compiled and connected to an Arduino UNO gives good results (around 21 C), compiling the same sketch but now for an Artemis ATP gives me 1037C... What ? Actually checking with a logic analyzer (or you can include print statements in readreg) shows that the ATP is constant receiving 0xffff
Checked the 3v3, in both cases that is 3.25V. So it is not the power supply.
Then looked with a logic analyzer. The time between writing the register address and starting reading from that address on the UNO takes 16.2us, the time on the ATP takes 98.7us. SAME CODE !!
So what ? one could think.. well according to the datasheet of the MLX90615 :
Code: Select all
Timeout H is the maximum time for which it is allowed for SCL to be high during communication. After
this time MLX90615 will reset its communication block assuming that the bus is idle (according to the SMBus
specification) - not more than 52µs
This means that the MLX90615 with the ATP is now reset and sending incorrect data.
For an MLX90614 the timeout H is 50us (according to the datasheet).
I suspect this is the reason why you get high results. I also suspect this is because of Mbed overhead, which is part of V2. When creating SoftwareSerial for V2 I run into similar microsecond issues.
I will try to spend more time analyzing in the coming days.