Hi guys,
I was reading the OPT3001 sensor using python. In order to ensure that I was reading it correctly, I decided to read the registers 0x7E and 0x7F. If I read the word I get the values of the bytes in it reversed. If I read the bytes twice it just sends the first byte again. Has anyone experienced and solved this?
Python Code:
import SMBus
bus.SMBus(1)
bus.write_byte(0x44, 0x7E)
bus.read_word_data(0x44,0x7E)
result: 18772 [which in hex is 0x4954] we are expecting 0x5449
read_byte(0x44)
result: 0x30
time.sleep(1)
read_byte(0x44) second time
result: 0x30 [expecting second byte]
____________________________
results from running as root:
i2cset -y 1 0x44 0x7E
i2cget -y 1 0x44 0x7E w
result>> 0x4954
i2cget -y1 0x44 0x7E b
result>0x54
i2cget -y1 0x44 0x7E b
result>0x54 [expecting 0x49]