I have two Atmel 2MB AT29C020 chips which I'd like to read and write on new chips. I have looked on the net for a long while and the only idea I found for a parallel chip is this:
However the chip used for the project has a slight different pinout. I am not competent enough to be able to modify the code to adapt it to my AT29C020 and I was wondering if this is the only way of doing it - or any guidance towards the right direction.
Right, you'll have to build kind of an programmer for writing data to the flash memory. Programming occurs on all 256 bytes of a sector in one run, with some time constraints. Reading is possible for every single byte, using e.g. the Arduino Mega parallel memory interface.
I'm not sure my skills go so further to be honest. I was hoping there was something more or less pre-made that I could use. If this is the only way, then maybe the post I linked above is a good starting point - with some guidance.
I built an EEPROM programmer and a ROM board for my Amstrad 464 in the mid-'80s.
At that time the devices all used the same data and address pins but sometimes different pins for the 'programming voltage', etc.
I recall using several 5 pin plugs on a single 5 pin wired-in socket, with different wires across the plug pins to move the voltages around. I also built a variable voltage power supply as some needed 21 volts while others needed 28volts.
To swap from one EEPROM to another I just needed to change the plug and set the voltage.
Perhaps you could use something similar, and if you needed to switch data / address pins around then use a 16 pin (or more if required) socket with header plugs wired to take any type of EEPROM?
Old (E)EPROMS were programmed byte by byte, the given flash memory is programmed page by page. All bytes of a page must be provided with some time constraint, and a longer gap will start burning the entire page.
I have now wired the chip and wrote a code which - in my view - works pretty well.
However, I am puzzled as I thought the chip only required 5V VCC - and it would be happy for me to program/read it via 3.3V GPO. However I can measure 5V on I/O pins of the chip. The datasheet is a bit unclear to me to be honest. It mentions a "minimum Output High Voltage CMOS" of 4.2V when VCC is 4.5V (page 4)? Does that make it unsuitable to be directly connected to a 3.3V device without something in the way that converts the voltages?
According to p.4 any voltage >2.0V will be read as high, so 3.3V logic on the input is no problem.
That chip indeed needs to be powered at 5V, so its own outputs will be close to 5V when high. That is a problem for your Due. You need some form of level shifting. If it's one way (high to low), a simple voltage divider is fine.
If you want to be safe add a 10k resistor to all data lines; thin if the chip sets that to output, 5V, you won't risk killing your Arduino (the clamping diodes will be handling that just fine).
thank you both. Yes, I understand I am not using the right hardware but it's a fun project and I'd like to keep the budget down - or I'd buy a programmer!
I did not realise that outputs would be 5V. Thanks.
Sorry for asking a silly question - my electronics skills are just basic - what do you mean with "if it's one way (high to low)"?
If the signal is unidirectional (output -> input) and output is 5V, input may be less, a passive voltage divider is sufficient for level shifting. Otherwise active level shifters may be required, using one or more transistors.
1: Make two different wiring, one for reading and one for writing and move the chip and the Arduino depending on what I have to do.
2: go with something more complex as you suggest.
The point with (1) is that I read that during programming the chip will toggle one of the I/O after each sector has been submitted and will stop toggling it when it's done, basically giving the green light for sending the next sector. I suppose I can just wait a few milliseconds and just assume that it's going to be fine? The 5V on the output will appear anyway though.
What would an "active level shifter" imply? I'll google it in the meantime!
tony359:
what do you mean with "if it's one way (high to low)"?
Signal direction. Some pins will only ever be an output or an input, some pins may switch between both depending on the job at hand.
So for your level shifters it matters which direction the pins go (5V output to 3.3V input needs level shifting; 3.3V output to 5V input doesn't need anything) and how fast it goes.
Actually, if you do need both directions, a single resistor between the pins may actually do the job just fine, as the clamping diodes on the input will protect it from overvoltage, with the resistor in turn protecting the input from overcurrent. 4k7 or 10k is a good value for this.
"Yes". I mean, I read the document and I believe I understand how it works.
I've written something that cycles through all the addresses. When each address is set, the control pins trigger and the chip outputs the correspondent byte for that address. At that point the board reads the I/O and moves to next address. And so on. And yes, I understand that read/write operations are done on a sector basis and when something is written to a specific sector it needs to be sent as a whole within a timeframe or the chip will assume it's done and will start the internal programming cycle.
I need to change a few things but in theory I should be able to read from the chip - only, right now I get kind of random values. I hope it's because the chip has never been programmed before: the datasheet says that anything that is not programmed gets into an "undetermined" state.
I need to write something as a test and then I'll try to read it back.