---------- Forwarded message ---------
From: <rh100605(a)aol.com>
Date: Thu, 11 Aug 2022, 2:56 pm
Subject: Re: [flashrom] Setting page size in AT45db081d spi flash
To: shreeyash335(a)gmail.com <shreeyash335(a)gmail.com>
Shreeyash,
Just for your information, the chinese flash programmers have specific
device types for each page size such as AT45DB081E-264 or AT45DB081E-256
and presumably what ever the setting for page size it overwrites if
necessary.
Beware the AT45DB081D version is one time programmable for page size so
that, I believe, the existing code is acting correctly as only the change
from 264( default shipped state) to 256 bytes is allowed and only once. The
E version allows the change up to 10,000 times!
See chapter 13 of the D specification.
I think we need a specific new flashrom device type for the AT45DB081E-264/256
family unless you have a better idea
Regards
Rob
-----Original Message-----
From: Shreeyash Pandey <shreeyash335(a)gmail.com>
To: rh100605(a)aol.com
Sent: Tue, 9 Aug 2022 10:40
Subject: Re: [flashrom] Setting page size in AT45db081d spi flash
>What I was looking for was maybe a flag that defined the page size
required
>and altered it if necessary.
This would be great. I suspect other AT45* chips may have this feature as
well,
they'd benefit from a universal scheme.
Are you able to read the status register without any mods?. The man page
makes
it clear that ch341 doesn't support any parameters. Something like
`flashrom -p
ch341:read_status` is what we need. Moreover, What output does
--wp-status produce?
>I am not a contributor to Flashrom but any mod I make I would like to share
>with others. I believe it would be better if a maintainer came up with a
>scheme that fitted all spi flash that you support with different page
sizes.
Totally. I'd be up to volunteer help if needed.
Regards
Shreeyash
On Mon, Aug 8, 2022 at 3:53 PM <rh100605(a)aol.com> wrote:
Shreeyash,
Thank you for such a prompt reply. I can see what you have done in the code
you supplied.
The rest of the code is very aware of page size on read/write/erase, so
needs to read the status register to work correctly
The programmer I am using is the CH341A modified to work at 3.3v
As I see it I would have to have 3 builds of Flashrom
1. Set 256 page size
2. Set 264 page size
3. as before modification to perform write and reads
What I was looking for was either a CLI flag that allowed me to issue a one
time command. Dangerous I know !
Or maybe a flag that defined the page size required and altered it if
necessary.
I am not a contributor to Flashrom but any mod I make I would like to share
with others.
I believe it would be better if a maintainer came up with a scheme that
fitted all spi flash that you support with different page sizes.
Regards
Rob
-----Original Message-----
From: tunabomber <shreeyash335(a)gmail.com>
To: rh100605(a)aol.com
Sent: Mon, 8 Aug 2022 15:31
Subject: Re: [flashrom] Setting page size in AT45db081d spi flash
Hey Rob,
I don't see that flashrom has an option to re-configure the chip's page
size,
nor did I find a way to send a command directly to the chip.
However, I am thinking of a hack you could use here.
File at45db.c implements the operations of your chip. We could modify one
of the
functions here that we shall use to send our four bytes of data. The very
first function
`at45db_read_status_register` is simple enough and should get the job done.
Replacing 'AT45DB_STATUS' with '0x3d, 0x2a, 0x80, 0xa7' will send these
bytes to
the chip when we ask flashrom to read the status register for us.
I've attached the modified file with this email. Diff it, if you may to see
the
difference. Re-compile flashrom by following build instructions in the
README. Now read the status registers, this should send our string to the
chip,
re-configuring it.
Reading status registers, I believe depends on the programmer? (Which one
are
you using?). There's very little on this in the man page except for the
section
on SPI Status Register for the dummy programmer. See if that is of any help.
Alternatively, you could modify some other function in a similar manner.
If you are not so sure about this, maybe wait for the more experienced folks
around here to see your message. I am only getting started with hardware
hacking.
Regards
Shreeyash
On Sun, Aug 7, 2022 at 6:14 PM Rob via flashrom <flashrom(a)flashrom.org>
wrote:
I have used Flashrom to backup a memory image in a radio using the
AT45DB081E spi flash memory. The read operation worked well using the
Flashrom device set as AT45DB081D
I bought some more used AT45DB081E chips to write the saved image and
Flashrom objected by stating that the image was too big by 32767 bytes
I edited image by removing the last 32767 bytes and Flashrom wrote the used
chips and verified successfully using the device setting AT45DB081D
While reading the datasheet I noticed that the AT45DB081D/E has two page
sizes 256 and 264 bytes which explains the 32767 bytes difference in image
sizes
It seems FlashROM is aware of the page size setting!
However I cannot see how read the status register to see the page size set
or how to change it using the 0x3D 0x2A 0x80 0xA6 / A7 command as
described in Chapter 11 of the AT45DB081E datasheet
To summarise I want to change the page size of an AT45DB081E back to 264 to
repair the radio and cannot see how to use Flashrom to do it
Regards
Rob
_______________________________________________
flashrom mailing list -- flashrom(a)flashrom.org
To unsubscribe send an email to flashrom-leave(a)flashrom.org