I'm using linux over i2c to load a patch low region binary file. The smbus library I have has a hard limit of 32 bytes per transaction. Can I safely load less than 64 bytes at a time to DATA1 (reg 0x09) and just increment through my file? I'll paste a copy of my code below if someone can offer some suggestions on how to improve this. So far I'm not getting patch commands working because I'm battling the smbus library. I've successfully written to registers when the device is in APP mode and can change the behavior that I wanted but I need to load a patch for my system needs. I used slva972a as a reference.def load_patch():
PTCr = [ord(i) for i in 'PTCr']
PTCs = [ord(i) for i in 'PTCs']
PTCd = [ord(i) for i in 'PTCd']
PTCc = [ord(i) for i in 'PTCc']
resetToPatch = bus1.write_i2c_block_data(tps1, CMD1[0], PTCr)
startPatch = bus1.write_i2c_block_data(tps1, CMD1[0], PTCs)
f = open("/root/scripts/tpslib/mac_0.0.2_low_ptcPatch.bin", "rb")
dat = f.read()
f.close()
nbytes = len(dat)//32
j = 0
while nbytes > 0:
n = nbytes
if nbytes > 32 : n = 32
dataToSend = bus1.write_i2c_block_data(tps1, INDATA1[0], dat[j:j+n])
sendData = bus1.write_i2c_block_data(tps1, CMD1[0], PTCd)
nbytes -= 32
j += 32