Hi - I’ve also had problems with reading correct distances. I’ve ported the code to C, running on an NXP ARM microprocessor, and was getting bad values. Then, as a shot in the dark, applied the fix listed in the original topic- reg A0 = 0x2198 and now am getting values that make sense.
Is the eprom data specific for each board, or generic for the design? Can you send me a copy please so I can check the other values? Not sure if I can read the data directly from the eprom, but can compare with registers once the eprom load has completed.
I posted this in the original topic, but that says that it is closed, so reposting here.
The EEPROM data contains both calibration values specific to your board and other data that is the same across all boards. If the same correction to register 0xA0 that fixed the other user’s board also worked for you, it’s possible yours was corrupted in the same way. However, so that we can make sure, could you also post the output of the ReadEEPROM example from the library with your board?
Here’s the eprom data Kevin - I think it’s correct! It’s a little complicated as my I2C routines are completely different from the Arduino ones, so translating is complex. Haven’t got the serial number code working yet - let me know if you really need that.
Regards. Andy
It looks like the first two bytes of the EEPROM got corrupted, just like what happened to the first user in the other thread, so you should be able to fix it permanently it by running the same program I posted there. (If you have an Arduino available, it might be easiest to use that so you can run the program directly, but it should also be possible to translate it to a different platform if you are careful.)
Afterwards, if you can confirm that the first 2 bytes changed to \xb4 \xf0, that should indicate the fix worked. Please let me know if you run into any issues.
I’m glad the fix worked for you. It seems like the first few bytes of the EEPROM got corrupted to write an incorrect value to register 0xA0 (without affecting the final value of register 0xB4). The temporary fix restores what’s supposed to be in 0xA0, and the permanent fix restores the EEPROM so it does not overwrite 0xA0 incorrectly.