Mega-Cart
Moderator: Moderators
- eslapion
- ultimate expander
- Posts: 5458
- Joined: Fri Jun 23, 2006 7:50 pm
- Location: Canada
- Occupation: 8bit addict
My understanding, after reading the datasheet of the M29F032 is that it is possible to write data into it one byte at a time.
Also, it is possible to give it a series of pokes that triggers either a single 64k block erasure or a full chip erasure.
By default, the whole chip is empty and ready to receive data.
Just like an EPROM, the chip is filled with ones and writing data into it makes zeros appear. Erasing data can only be done by chunks of 64k or the whole chip.
It works a bit like a CDRW. By default, the chip is completely empty, you can add more and more data into it as you go along but erasing is an all or nothing deal.
Writing one byte appears to require 10us. Normally, you would have to wait for a signal that comes back from the chip before writing more data but since the VIC is a very slow machine compared to what this is designed to deal with, just putting a small ML loop to wait should do the job.
Also, after every byte write, it is possible to read back some sort of status register which tells you if the writing is over or not and if it was successful.
For example, trying to write $FF into a byte where you had $00 should give you a failure. Writing $00 where you had $FF should be sucessful.
Do not confuse flash cards with flash memory chips. It is not the same thing at all. MMC, SD and other cards use complicated serial protocols.
FLASH memory chips simply use a coded series of pokes to control it and it is extremely easy to do.
Also, it is possible to give it a series of pokes that triggers either a single 64k block erasure or a full chip erasure.
By default, the whole chip is empty and ready to receive data.
Just like an EPROM, the chip is filled with ones and writing data into it makes zeros appear. Erasing data can only be done by chunks of 64k or the whole chip.
It works a bit like a CDRW. By default, the chip is completely empty, you can add more and more data into it as you go along but erasing is an all or nothing deal.
Writing one byte appears to require 10us. Normally, you would have to wait for a signal that comes back from the chip before writing more data but since the VIC is a very slow machine compared to what this is designed to deal with, just putting a small ML loop to wait should do the job.
Also, after every byte write, it is possible to read back some sort of status register which tells you if the writing is over or not and if it was successful.
For example, trying to write $FF into a byte where you had $00 should give you a failure. Writing $00 where you had $FF should be sucessful.
Do not confuse flash cards with flash memory chips. It is not the same thing at all. MMC, SD and other cards use complicated serial protocols.
FLASH memory chips simply use a coded series of pokes to control it and it is extremely easy to do.
Last edited by eslapion on Tue Jul 31, 2007 12:43 pm, edited 2 times in total.
Perhaps you are correct. Applications I have used to write to flash chips will not write unless sector is erased first.eslapion wrote:My understanding, after reading the datasheet of the M29F032 is that it is possible to write data into it one byte at a time.
Also, it is possible to give it a series of pokes that triggers either a single 64k block erasure or a full chip erasure.
By default, the whole chip is empty and ready to receive data.
It works a bit like a CDRW. By default, the chip is completely empty, you can add more and more data into it as you go along but erasing is an all or nothing deal.
FLASH memory chips simply use a coded series of pokes to control it and it is extremely easy to do.
Maybe this is to keep copy utility simple as 64K block is pretty small these days.
Mega-Cart: the ultimate cartridge for your Commodore Vic-20
- eslapion
- ultimate expander
- Posts: 5458
- Joined: Fri Jun 23, 2006 7:50 pm
- Location: Canada
- Occupation: 8bit addict
Control codes for the M29F032:
To write one byte of data:
Poke $AA to $555 (equiv. to POKE 1365 +blk whatever,170)
Poke $55 to $2AA (equiv. to POKE 682 +blk whatever,85)
Poke $A0 to $555 (equiv. to POKE 1365 +blk whatever,160)
Poke (desired data) to (desired address) (equiv. to POKE address +blk whatever,data)
requires 10 to 200us to complete.
To perform full chip erase:
Poke $AA to $555 (equiv. to POKE 1365 +blk whatever,170)
Poke $55 to $2AA (equiv. to POKE 682 +blk whatever,85)
Poke $80 to $555 (equiv. to POKE 1365 +blk whatever,128)
Poke $AA to $555 (equiv. to POKE 1365 +blk whatever,170)
Poke $55 to $2AA (equiv. to POKE 682 +blk whatever,85)
Poke $10 to $555 (equiv. to POKE 1365 +blk whatever,16)
requires 40 to 200 seconds to complete. chip is specified to support in excess of 100'000 erase cycles.
To know if the operation is complete or has failed, read back from the chip any byte known to contain $FF. If what you get is not $FF then you have the value of the status register which can tell you if the operation is still ongoing or if there is an error condition.
Details about the specific meaning of every bit of the status register is in the datasheet, here: http://www.st.com/stonline/books/pdf/docs/7946.pdf
To write one byte of data:
Poke $AA to $555 (equiv. to POKE 1365 +blk whatever,170)
Poke $55 to $2AA (equiv. to POKE 682 +blk whatever,85)
Poke $A0 to $555 (equiv. to POKE 1365 +blk whatever,160)
Poke (desired data) to (desired address) (equiv. to POKE address +blk whatever,data)
requires 10 to 200us to complete.
To perform full chip erase:
Poke $AA to $555 (equiv. to POKE 1365 +blk whatever,170)
Poke $55 to $2AA (equiv. to POKE 682 +blk whatever,85)
Poke $80 to $555 (equiv. to POKE 1365 +blk whatever,128)
Poke $AA to $555 (equiv. to POKE 1365 +blk whatever,170)
Poke $55 to $2AA (equiv. to POKE 682 +blk whatever,85)
Poke $10 to $555 (equiv. to POKE 1365 +blk whatever,16)
requires 40 to 200 seconds to complete. chip is specified to support in excess of 100'000 erase cycles.
To know if the operation is complete or has failed, read back from the chip any byte known to contain $FF. If what you get is not $FF then you have the value of the status register which can tell you if the operation is still ongoing or if there is an error condition.
Details about the specific meaning of every bit of the status register is in the datasheet, here: http://www.st.com/stonline/books/pdf/docs/7946.pdf
- eslapion
- ultimate expander
- Posts: 5458
- Joined: Fri Jun 23, 2006 7:50 pm
- Location: Canada
- Occupation: 8bit addict
Considering what I know about the design of the megacart, I have a pretty good idea on how I would modify it to switch to a FLASH memory chip, specifically the M29F032 without ANY changes to the software components.
However, for me to be able to go into every specific details requires a complete schematics of what you have so far.
The idea is quite simple. Right now, you have 2 EPROMS each with his own latching system that each adds 7 lines to the 13 address lines coming from the VIC but nonetheless, each EPROM has its own /CE line.
Multiplex the output of the 2 latching systems onto a single set of 7 address lines destined to the chip. The multiplexing presents the values from the first latch when the /CE of the first ROM is activated and likewise for the second latching system and ROM.
Also, since you now have the content of the 2 ROMs available as consecutive memory areas into a single chip, have an extra address line set to 0 when the first latching system is active and set to one when the second latching system is active. That should give you a total of 21 address lines or 2Mbytes range of data.
Now the M29F032 has 22 address lines numbered 0 to 21. The very last address line is used to select if you want to "see" the upper or lower half of the 32Mbit (4MBytes) or FLASH. This you can do using whatever means you want.
However, for me to be able to go into every specific details requires a complete schematics of what you have so far.
The idea is quite simple. Right now, you have 2 EPROMS each with his own latching system that each adds 7 lines to the 13 address lines coming from the VIC but nonetheless, each EPROM has its own /CE line.
Multiplex the output of the 2 latching systems onto a single set of 7 address lines destined to the chip. The multiplexing presents the values from the first latch when the /CE of the first ROM is activated and likewise for the second latching system and ROM.
Also, since you now have the content of the 2 ROMs available as consecutive memory areas into a single chip, have an extra address line set to 0 when the first latching system is active and set to one when the second latching system is active. That should give you a total of 21 address lines or 2Mbytes range of data.
Now the M29F032 has 22 address lines numbered 0 to 21. The very last address line is used to select if you want to "see" the upper or lower half of the 32Mbit (4MBytes) or FLASH. This you can do using whatever means you want.
Menu software uses many features of bank switching with existing hardware configuration.eslapion wrote:Considering what I know about the design of the megacart, I have a pretty good idea on how I would modify it to switch to a FLASH memory chip, specifically the M29F032 without ANY changes to the software components.
I'm about month behind where I would like to be with this project.
So opening up to hardware revision and more testing will put completion date off further.
I usually spend about 3-4 hours daily on the project and some full days on the weekends. I'm sure NBLA000 spends even more daily.
I have other projects that I would like to pursue, both technical and ones for other hobbies.
Plus I'm sure NBLA000 has a project he needs to devote more attention to, later in August.
So, in order to ensure completion, we need to proceed forward with what we have. There will always be a number of ways to come up with a solution to technical challenge.
What we have works, it is reasonably cost effective, and except for the size of eproms, it uses same level of technology which was availble at the time Vic-20 was produced. It is a retro circuit.
Mega-Cart: the ultimate cartridge for your Commodore Vic-20
This is a broad assumption to make, given you do not know all of the functionality or have code.eslapion wrote:Without a SINGLE BIT of code change...6502dude wrote:Menu software uses many features of bank switching with existing hardware configuration.
I do not currently have hardware to support TSOP form factor.
While a simple programming alogrithim is needed to write / read to 29F032, I do not have have the code, wish to write it, or time to test it.
In addition, changes and subtitutions are made to rom images on a daily basis. Even if I had code for in circuit programming, I would need to do sector erases and re-write 64K blocks - just to perhaps change a couple of bytes. While it would be nice to do updates via Vic-20, it would be considerably more combersome and less efficient than using hex editor and burning eproms on PC.
Adoption of design change for flash ram at this point would adversly impact completing the project. So, I will not consider it further.
Mega-Cart: the ultimate cartridge for your Commodore Vic-20
My soldering iron was out again this weekend.
Serveral weeks ago eslapion mentioned that some games do not start with 3K RAM expansion present.
I tested all of the cart ROM images but did not find this problem.
However, I did find the problem with a cassette game I have - King's Ransom
(I sent a TAP image of this game to ARMA a couple of years ago).
NBLA000 provided me detail on a few other games with basic loaders which would not work with 3K RAM present.
So, I added option to MegaCart to disable 3K RAM expansion. I did this with spare gates and did not need to add any additional parts to the exisiting circuit board.
I'm pleased that eslapion pointed the problem out.
Now we have a MegaCart which is more compatible.
Serveral weeks ago eslapion mentioned that some games do not start with 3K RAM expansion present.
I tested all of the cart ROM images but did not find this problem.
However, I did find the problem with a cassette game I have - King's Ransom
(I sent a TAP image of this game to ARMA a couple of years ago).
NBLA000 provided me detail on a few other games with basic loaders which would not work with 3K RAM present.
So, I added option to MegaCart to disable 3K RAM expansion. I did this with spare gates and did not need to add any additional parts to the exisiting circuit board.
I'm pleased that eslapion pointed the problem out.
Now we have a MegaCart which is more compatible.
Mega-Cart: the ultimate cartridge for your Commodore Vic-20
- eslapion
- ultimate expander
- Posts: 5458
- Joined: Fri Jun 23, 2006 7:50 pm
- Location: Canada
- Occupation: 8bit addict
I would simply make the M29F032 appear at the same place and in the same manner as the 2 EPROMs and change nothing to the rest.6502dude wrote:... This is a broad assumption to make, given you do not know all of the functionality or have code.
...
There are lots of changes between the hardware of the original VIC and the VIC-CR yet they are both 100% software compatible with one another.
I understand you may not be able to afford the energy and time to do such a change.
However, once your work is over, would you allow me to take a look at your schematic and make a flash version of the megacart?
I suspect it might even turn out to be cheaper than the original.
I am pleased to announce that I have completed Megacart 2 prototype board.
This is essentially the same design as the first board, with a cleaner layout (no re-work), and a slightly improved reset circuit.
Here are pictures of completed board:
It works quite nicely
This is essentially the same design as the first board, with a cleaner layout (no re-work), and a slightly improved reset circuit.
Here are pictures of completed board:
It works quite nicely
Last edited by 6502dude on Sat Jul 26, 2008 5:09 pm, edited 2 times in total.
Mega-Cart: the ultimate cartridge for your Commodore Vic-20
Great, now we are ready for tests on PAL machines too6502dude wrote:I am pleased to announce that I have completed Megacart 2 prototype board.
This is essentially the same design as the first board, with a cleaner layout (no re-work), and a slightly improved reset circuit.
Mega-Cart: the cartridge you plug in once and for all.
Wow!
It has been a long time since I posted an update in hardware forum on this project.
As noted in buy/sell thread, I had planned to have prototype PCB done shortly after vacation in mid July.
Due to work projects, I did not have as much hobby (or vacation) time as expected.
Anyway, here is image of MegaCart Prototype 3.
Now featuring fewer messy wires!!!
I received prototype boards yesterday via courier.
These do not have soldermask and traces are only 10mils wide, so it was a bit of a PITA to solder and avoid solder bridges.
It was a really a pleasure once again see the feature rich MegaCart menu after this was assembled and plugged in.
I built this full scale protoptype to:
a) Validate schematic and CAD work
b) test STK12C68 NVRAM subsitute for DS1225
c) have a unit to test final eprom/firmware release
Next steps are to optimize layout and finalize reduced PCB size, based on SMT components, and send this for volume PCB production.
It has been a long time since I posted an update in hardware forum on this project.
As noted in buy/sell thread, I had planned to have prototype PCB done shortly after vacation in mid July.
Due to work projects, I did not have as much hobby (or vacation) time as expected.
Anyway, here is image of MegaCart Prototype 3.
Now featuring fewer messy wires!!!
I received prototype boards yesterday via courier.
These do not have soldermask and traces are only 10mils wide, so it was a bit of a PITA to solder and avoid solder bridges.
It was a really a pleasure once again see the feature rich MegaCart menu after this was assembled and plugged in.
I built this full scale protoptype to:
a) Validate schematic and CAD work
b) test STK12C68 NVRAM subsitute for DS1225
c) have a unit to test final eprom/firmware release
Next steps are to optimize layout and finalize reduced PCB size, based on SMT components, and send this for volume PCB production.
Mega-Cart: the ultimate cartridge for your Commodore Vic-20
- eslapion
- ultimate expander
- Posts: 5458
- Joined: Fri Jun 23, 2006 7:50 pm
- Location: Canada
- Occupation: 8bit addict
Could the Megacart benefit in any way to have a single 16 Mbit ROM instead of two 8Mbut ROMs?6502dude wrote:Next steps are to optimize layout and finalize reduced PCB size, based on SMT components, and send this for volume PCB production.
I think this could reduce your final production cost.
Be normal.