R
@jmarcelino
I had high hopes and was rather pleased you pointed out the variant using a controlled stop. Sady it doesn't work for me.
Here is my code. Changing the string I try to write doesn't change anything.
I hadsome concern in my Python noobishness that my assignments to the addressing array may not be correct but a print(str(addressing)) of it showed it was correct (not in th below code).
Oh. I saw you mention an older I2C eeprom you had. I checked it out - it may be a 5v only part.
---- begin ----
from machine import I2C
import time
# configure the I2C bus
# i2c = I2C(0, I2C.MASTER, baudrate=100000, pins=('P9', 'P10'))
i2c = I2C(0, I2C.MASTER, baudrate=100000)
print('scanning')
print(i2c.scan()) # returns list of slave addresses, tells me chip is on the bus
loops = 0
addressing = bytearray(3)
addressing[0] = 0xA0 # Write command, chip 0 on bus
addressing[1] = 0x00 # MSB address
addressing[2] = 0x00 # LSB address
i2c.writeto(80, addressing, stop=False) # setup chip, no stop means more to follow
i2c.writeto(80, '123hello world456') # this should be a "page write" (assume)
time.sleep(1) # crazy long. 5mS should be enough
addressing[0] = 0xA1 # make it a read command, chip 0 on bus
while 1:
i2c.writeto(80, addressing, stop=False) # setup chip, no stop means more to follow
time.sleep(0.1) # not necessary. "try anything"
result = i2c.readfrom(80, 32) # clock out 32 bytes in page mode (assume)
print(str(loops) + ' ' + str(result))
time.sleep(1.0)
loops = loops + 1
---- it returns ----
scanning
[80]
0 b'\x0f\x0c\x08\x12\x13,\x01Y\x02C\x04\x07\n\x10\x00\xff\x0f\x0c\x08\x12\x18,\x01I\x03\xfb\x04\x1e\n\x11\x00\xff'
1 b'\x0f\x0c\x08\x12\x13,\x01Y\x02C\x04\x07\n\x10\x00\xff\x0f\x0c\x08\x12\x18,\x01I\x03\xfb\x04\x1e\n\x11\x00\xff'