does somebody used an I2C memory like a 24LC256 or I2C512 ?
Each time I try to write at any adress, I always read the same value :
Code: Select all
# I2C Memory : 24LC512 # Wired : A0, A1, A2 and WP to Vss (GND) # 4k7 pullup resistors to Vdd (3.3V) on SCL and SDA pins # The I2C memory response '80' to a i2c.scan() from machine import Pin, I2C from time import sleep_ms I2C_BUS = I2C(1, scl=Pin(22), sda=Pin(21), freq=400000) # Address in the 24LC512 where I try to read/write some data adress_stock = 0x10 print("Adress R/W : ", adress_stock) # Is there something before I try to write ? print("Read before : ", I2C_BUS.readfrom_mem(80, adress_stock, 4 ) ) sleep_ms(10) # Try to write '0x1234' in the memory at 0x10 adress val = b'1234' print("try to write : ", val ) I2C_BUS.writeto_mem(80, adress_stock, val) sleep_ms(10) # Does the memory received and stocked the information ? print("verify : ", I2C_BUS.readfrom_mem(80, adress_stock, 4) )
>>> %Run -c $EDITOR_CONTENT
Adress R/W : 16
Read before : b'\xff\xff\xff\xff'
try to write : b'1234'
verify : b'\x00\x00\x00\x00'
If somebody have an idea I will be grateful