Hello everyone!!
I am trying to interface an EEPROM (AT24C512, 512kbits (64KB)) with pyboardV1.1. I have found success using the test script here.
https://github.com/dda/MicroPython/blob ... /EEPROM.py
The time taken for erase, write and read seems to be a bit longer being single byte is written every time to the eeprom. Is there a way to do a page write (128 bytes at a time for AT24C512).
EEPROM Page write - AT24C512
Re: EEPROM Page write - AT24C512
Isn't it as simple as:
or...
Code: Select all
from machine import I2C
i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)
buf = bytearray(b'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed metus, hendrerit in elit quis, ultrices Maecenas lobortis sed orci.')
i2c.writeto_mem(0x50, 0, buf, addrsize=16) # write 128 bytes to slave 0x50, slave memory 0x00
buf2 = i2c.readfrom_mem(0x50, 0, 128, addrsize=16) # read 128 bytes from slave 0x50, slave memory 0x00
Code: Select all
from pyb import I2C
i2c = I2C(1, I2C.MASTER, baudrate=100000)
buf = bytearray(b'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed metus, hendrerit in elit quis, ultrices Maecenas lobortis sed orci.')
i2c.mem_write(buf, 0x50, 0x00, addr_size=16) # write 128 bytes to slave 0x50, slave memory 0x00
i2c.mem_read(128, 0x50, 0x00, addr_size=16) # read 128 bytes from slave 0x50, slave memory 0x00
Re: EEPROM Page write - AT24C512
Hi!!
Thanks for the idea.
I tried this with no success. Getting the error
"can't convert byte to int"
For your reference, I'm trying to erase the EEPROM (theoretically). Filling '0xFF' in all 64 K locations
What am I missing...?
Thanks in advance!!
Thanks for the idea.
I tried this with no success. Getting the error
"can't convert byte to int"
For your reference, I'm trying to erase the EEPROM (theoretically). Filling '0xFF' in all 64 K locations
What am I missing...?
Thanks in advance!!