Other Parts Discussed in Thread: SM72295
I am trying to read/write SM72442 registers using I2C from Raspberry Pi. I am able to detect my device using "i2cdetect -y 1" and it has an address 0x03. For now, I am trying to read the contents of reg0. Please find my code below:
import smbus
bus = smbus.SMBus(1)
device_id = 0x03
register = 0xE1 #base register address 0xE0
try:
b = bus.read_byte_data(device_id, register)
print(hex(device_id), b)
except:
pass
It prints ('0x3', 7). Apparently, read_byte_data only tells the number of bytes for that registers. However even if I change the register number to any other value, it always gives a value of 7. From the documentation, I understand that I need to first send the address, get an ack from SM72442, send the command register, get and ack, and do repeated start onwards. However, I am unable to figure out how to do it with python smbus. Any help on reading/writing registers with smbus or any other linux-based low level I2C library would be really helpful.