Author Topic: Dumping flash memory ft2232h  (Read 756 times)

0 Members and 1 Guest are viewing this topic.

Offline t4rmoTopic starter

  • Contributor
  • Posts: 14
  • Country: es
Dumping flash memory ft2232h
« on: July 23, 2021, 11:19:14 am »
I tried to read the memory's flash content with my ft2232h.
I wrote a script to emulate the read's chronogram with pyftdi but i haven't able to communicate with the flash.(I don't receive flash's response)
Any idea of what happen?

Code: [Select]
from pyftdi.spi import *
fd = open('dump','wb')

spi = SpiController()

spi.configure('ftdi://ftdi:2232:2:7/1')

slave = spi.get_port(cs=0,freq = 10E6)
address = b'\x00\x00\x00'

read_command = b'\x03'
release_deep_power = b'\xAB'

slave.write(release_deep_power)
slave.write(read_command + address)
while 1:
    data_out=slave.read(1)
    fd.write(data_out)

In theory with a single read instruction you can dump the whole memory due to a internal counter
« Last Edit: July 23, 2021, 11:25:33 am by t4rmo »
 

Offline abyrvalg

  • Frequent Contributor
  • **
  • Posts: 824
  • Country: es
Re: Dumping flash memory ft2232h
« Reply #1 on: July 23, 2021, 01:00:54 pm »
According to PyFTDI SPI documentation https://eblot.github.io/pyftdi/api/spi.html#pyftdi.spi.SpiPort.write both write() and read() assert nCS at start and deassert at the end of transfer by default, so you have a broken nCS sequence. Try this:
Code: [Select]
FLASH_SIZE = 0x100000 #put your size here
slave.write(read_command + address, start=True, stop=False) #assert nCS and keep it asserted
for i in range(FLASH_SIZE-1):
    data_out=slave.read(1, start=False, stop=False) # don't touch nCS
    fd.write(data_out)
data_out=slave.read(1, start=False, stop=True) #read last byte and deassert nCS, terminating the operation
fd.write(data_out)
 
The following users thanked this post: t4rmo

Offline t4rmoTopic starter

  • Contributor
  • Posts: 14
  • Country: es
Re: Dumping flash memory ft2232h
« Reply #2 on: July 24, 2021, 10:11:49 am »
Thank you abyrvalg, you are right
Now I'm going to try the writing

Regards
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf