A tool to read/write from/to MRAM chips with FTDI programmers.
# Reading
mramtool -f 'ftdi://ftdi:2232:TG111464/2' -c 'S3A1004R0M' -r content.bin
# Writing
mramtool -f 'ftdi://ftdi:2232:TG111464/2' -c 'S3A1004R0M' -w test-data/1Mb_55.bin
from mramlib import MRAM, get_chip_info
ftdi_url = 'ftdi://ftdi:2232:TG111464/2' # see `mramtool -lf`
chip_info = get_chip_info('S3A1004V0M') # see `mramtool -lc`
m = MRAM(ftdi_url, chip_info)
# read 16 bytes starting from address 0
print(m.read(0, 0x10))
# write 8 bytes to address 0x100
m.write(0x100, 8*b'\xAA')# By default write() calls the chips unlock function which sends
# a sequence of commands to reset chip specific write protection modes.
# Also by default, write() sends the WEL command before every chunk
# written. We can prevent this by doing the following.
m.send_raw(b'\x06') # send WEL command manually
# (activate trigger here)
m.write(addr, data, unlock=False, wel_cmd=None) # send only write command