Facepalm. The STM32 board that I was using has an AT24C08 1024k EEPROM on the back, exposed at the same address 0x50.
It actually has 4x devices, each with 256k. [80,81,82,83].
My tests that were passing were to the onboard EEPROM, not the LC Tech module!
I2C EEPROM on uPy/ESP8266?
Re: I2C EEPROM on uPy/ESP8266?
Just a thought... The eeprom memory is 16 bits. Arduino sends 2 bytes consisting of MSB followed by LSB. Are we sending a 16 bit address with micropython?
Re: I2C EEPROM on uPy/ESP8266?
Only if you passed addrsize keyword argument to writeto_mem that specifies it. See http://micropython.org/resources/docs/e ... operations
Note that the documentation is wrong and the addrsize is already supported on ESP8266.
Note that the documentation is wrong and the addrsize is already supported on ESP8266.
Re: I2C EEPROM on uPy/ESP8266?
Ok, so this works on my WeMos D1 Mini on 3v3:
Adding addrsize=16 to reads/writes makes it work.
Code: Select all
# esp8266 -- eeprom
# 3v3 ------ vcc
# gnd ------ gnd
# D1 scl --- scl
# D2 sda --- sda
from machine import I2C, Pin
i2c = I2C(scl=Pin(5), sda=Pin(4), freq=400000)
i2c.scan()
# [80]
# does not work, addrsize defaults to 8.
i2c.writeto_mem(0x50, 0, b'hello world')
i2c.readfrom_mem(0x50, 0, 11)
# b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
# does work!
i2c.writeto_mem(0x50, 0, b'hello world', addrsize=16)
i2c.readfrom_mem(80, 0, 11, addrsize=16)
# b'hello world'
i2c.readfrom_mem(80, 2, 11, addrsize=16)
# b'llo world\xff\xff'
Re: I2C EEPROM on uPy/ESP8266?
Hello,
I'll give this "address size" solution a shot this evening (in 9 hours here).
Anyway, thank you, you are very talented and very well educated !
i'll keep you informed.
I'll give this "address size" solution a shot this evening (in 9 hours here).
Anyway, thank you, you are very talented and very well educated !
i'll keep you informed.
Re: I2C EEPROM on uPy/ESP8266?
@mcauser:
That works *perfectly*!
Thank you so much...
That works *perfectly*!
Thank you so much...
Re: I2C EEPROM on uPy/ESP8266?
That's great.....Thanks!
Re: I2C EEPROM on uPy/ESP8266?
Work like a charm !