News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_wilco2009

Megaflash and 29F040 flash memory

Started by wilco2009, 09:33, 20 November 13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wilco2009


As you known, I have built my own megaflash and now I'm buying components to send kits to a group of friends.


Nowadays there are a lot of problems with the orders to china, and I'm having problems to get the flash memory chips 29C040-90. Twice my packet have been lost in the way.


I would like to ask you if it is possible to use 29F040 chips instead 29C040, because this model is much more easy to find in Spain and it is cheaper than the recommended one.


Reading both datasheets I can't find relevant differences.

gerald

The main difference is the smallest erasable sector
256 bytes for 29c040
65536 bytes (64k) for 29F040

With  a 29F040, programming one rom slot (16k) requires that you backup the 48k you don't change, erase 64k and ther re-program 64k (new 16k + old 48k). That mean you at least have 128k of ram (for backup) and the software that deal with it.

You may try to get some 39SF040 (SST/Microchip), these use 4k sectors. That the one used on Flashgordon.


wilco2009


Thanks for your reply, gerald.


Is really necessary to erase a block before program? Is ROM Manager doing it?


I have read the datasheet of both models and erase is made by sectors, but program is made byte by byte in 29F040.


In model 29C040 write operation is made in sectors of 256 bytes. After activating /WE line, every byte of the sector have to be followed by a /WE high to low transition.
After 150 microseconds with no changes in "/WE" write operation finishes


Protection can be activated or deactivated by a sequence of commands




In model 29F040 program operation is made byte by byte. Internally it has 64Kb blocks, but it is theoretically transparent to the user.
In the Datasheet can be read that the write operation sequence have to done in four steps:


1st cycle - Write AAh at 5555h
2nd cycle - Write 55h at 2AAAh
3rd cycle - Write A0h at 5555h
4th cycle - Write Program Data at Program Address.


Looking that, write operation is totally different in both chips, then 29F040 probably is not compatible with MegaFlash ROM Manager and others.


By other hand, previous described procedure seems to be only to be used in protected mode.
My question is, do you know if it is the only way to write in 29F040? or if I unprotect the chip previously, Can I write in the same way than 29C040 chip?

gerald

Quote from: wilco2009 on 11:50, 20 November 13
Is really necessary to erase a block before program? Is ROM Manager doing it?
Yes and Yes.
However, for 29c040 the erase is done by the flash itself (which is quite unusual)
The ROM manager has to do it. And TFM Rom Manager does it in its FlashGordon version (for 39SF040)

Quote from: wilco2009 on 11:50, 20 November 13
I have read the datasheet of both models and erase is made by sectors, but program is made byte by byte in 29F040.
Like almost all flash devices.
Basically, only the erase command can program bit to 1 (byte to 0xFF), and individual byte programming only program bit to 0. That is, no way to toggle a bit from 0 to 1 without erasing a whole sector.

Quote from: wilco2009 on 11:50, 20 November 13
In model 29C040 write operation is made in sectors of 256 bytes. After activating /WE line, every byte of the sector have to be followed by a /WE high to low transition.
After 150 microseconds with no changes in "/WE" write operation finishes
Protection can be activated or deactivated by a sequence of commands
The Atmel 29C040 is a bit special, as it is targeting systems that need to frequently change small part of the content, without having to save big sectors.

Quote from: wilco2009 on 11:50, 20 November 13
In model 29F040 program operation is made byte by byte. Internally it has 64Kb blocks, but it is theoretically transparent to the user.
In the Datasheet can be read that the write operation sequence have to done in four steps:

1st cycle - Write AAh at 5555h
2nd cycle - Write 55h at 2AAAh
3rd cycle - Write A0h at 5555h
4th cycle - Write Program Data at Program Address.
That's the standard way of programming flashes. There is also a command that gives you the maker and model of the flash, so you can select the appropriate algorithm and sector size.

Quote from: wilco2009 on 11:50, 20 November 13
Looking that, write operation is totally different in both chips, then 29F040 probably is not compatible with MegaFlash ROM Manager and others.
You may want to adapt the ROM manager code for this flash as TFM kindly share the source.
You could start from the Flashgordon version as the 39SF040 uses a similar algorithm but with a smaller sector size. However, the backup functionality for the 48k erased will have to be added.

Quote from: wilco2009 on 11:50, 20 November 13
By other hand, previous described procedure seems to be only to be used in protected mode.
My question is, do you know if it is the only way to write in 29F040? or if I unprotect the chip previously, Can I write in the same way than 29C040 chip?
The only way is the one described in the datasheet  ;) .

wilco2009

Thank a lot, Gerald. Your answer helped me very much.

Bryce

You know your Flash ICs well gerald :)

The only thing that might be also worth mentioning is that backing up 48K would not only take a lot more time to flash a single ROM, but would also require 48K of the CPCs RAM to be held free at all times, leaving very little space for the ROManager program.

Bryce.

gerald

Quote from: Bryce on 12:35, 20 November 13
You know your Flash ICs well gerald :)
I spent so much time looking for suitable one on various project  ;D

Quote from: Bryce on 12:35, 20 November 13
The only thing that might be also worth mentioning is that backing up 48K would not only take a lot more time to flash a single ROM, but would also require 48K of the CPCs RAM to be held free at all times, leaving very little space for the ROManager program.
That's why a 128k is needed.
You use the full 2nd bank to backup the sector you want to program. Currently, only 16k from 2nd bank is used for programming, with a second 16k buffer for swapping. Swapping may not be possible any more.

IanS

Quote from: Bryce on 12:35, 20 November 13
You know your Flash ICs well gerald :)

The only thing that might be also worth mentioning is that backing up 48K would not only take a lot more time to flash a single ROM, but would also require 48K of the CPCs RAM to be held free at all times, leaving very little space for the ROManager program.

Bryce.
My flash card software supports the 29f040, it just copies the three 16k blocks into the extra 64k on a 6128, erases the 64K page, then copies them back. Not really practical on a 464/664 as you need 48K outside of the &c000-&ffff area for temporary storage, and >&c000 to write to, leaving no room for code.

TFM

Well, pretty much everything was told already...


However let me mention one thing... If you can't get the Flash chip used in the original MegaFlash, then you can use the Flash chip used in the FlashGordon, this is the SST 39SF040. In this case use ROManager for FlashGordon.


The ROManager source is available, you can adapt it for your purpose, but I would recommend to use previously used Flash chips, to future software must not deal with a big number of "personal solutions".







TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

IanS

Quote from: TFM on 20:43, 20 November 13
The ROManager source is available, you can adapt it for your purpose, but I would recommend to use previously used Flash chips, to future software must not deal with a big number of "personal solutions".
It's just a shame the MegaFlash design didn't allow reading from the flash chip when in write mode, the software could then read the flash chip ID and use the appropriate programming algorithm, without having to have version of the software for each flash type.

wilco2009

Many thanks guys.


At the end, when I did not expect it, I received my second packet of W29C040-90B chips.


Anyway this delay helped me to understand write operations in flash memories.

TFM

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Powered by SMFPacks Menu Editor Mod