Go Down

Topic: Programming parallel flash chips (Read 2865 times) previous topic - next topic

UziMonkey

I have some parallel flash chips from old motherboards I want to be able to program.  Since the parallel flash chips can't be programmed with SPI or anything like that, it's not straightforward.  Also, these chips can be programmed with low voltage, unlike some flash chips that can only be programmed with 12v.  And even if they needed 12v, that's a simple modification.  If I ever solder this up, I might include that as an option with a switch.

I haven't studied the data sheet for the flash chips in depth yet (maybe that would have been a good first step), but programming the chips consists of putting certain commands on the address and data bus and using the three control pins CE, OE and WR.  In total, there are 29 of these pins.  18 address lines, 8 data lines and 3 control lines.  I think I can just use some shift registers to reach these, because the Arduino certainly doesn't have enough pins.

So here's something I drew up.  I don't know how to use any CAD programs, so I just snapped a pic of my notebook.  I hope you all can see it well enough.

I've never used 74HC595's or 74HC165's before, I'm just going on the data sheets.  I'm going to have to shift all the data and address bits out then latch them in.  A few of the pins (well, 6 of them) won't be used on one of the 595's, but that's OK.

It just occurred to me that it's possible the highest 2 address bits aren't even used when programming.  It's just a case of removing one of the 595s if that's the case though.  Now that I write all this out, I wish even more that I'd read the flash chip docs better.

In order to read from the address bus, I'm going to have to put the 595 on the data bus into high impedance mode, latch the data into the 165 and clock it out.  The ShiftOut and ShiftIn instructions will be really helpful here.

Hopefully, I'll be able to post the image in the reply, see below

So...  will this work?

I had originally hoped to put this on a shield, but I think it might be too big for that.  Do you think I can cram this onto a prototype shield, including the space a ZIF socket takes up?

UziMonkey

It wouldn't let me post a link to the picture in my first post.  I'll try it here in my reply.


Grumpy_Mike

I would look at the data sheet as you may not be able to flip the lines fast enough.
What you have looks like it would work but it will be quite slow to drive it especially if you use digitalWrite(), you will probably have to go with direct port access.

How about using a MCP23016 for your data and address, this gives 16 I/O lines from the I2C bus. It is a lot less messy.

http://www.arduino.cc/playground/Learning/I2C

http://www.neufeld.newton.ks.us/electronics/?p=241


UziMonkey

I don't think speed is an issue.  You put all the bits on the address and data bus at the same time with the latch pin of the 595's, then pulse CE and WE low.  The flash chip them remembers its state until the next command, which as far as I can see can be anywhere in the future.

That chip can give me 16 lines in 1 chip, but I don't see how it's any different.  How will this chip, or any other chip that uses I2C be faster than the shift registers?

Speed is also not really much of an issue.  It's not like I'm programming a 4 gig flash chip or anything, most of these are 128k or so and I'll only be using up to 32k.

UziMonkey

#4
Jan 08, 2009, 02:28 am Last Edit: Jan 08, 2009, 05:28 am by uzimonkey Reason: 1
I see what you mean with the I/O Extender chip now.  I hadn't realized it was bi-directional.  However, I came up with something better that doesn't require a 595 in 3-state or a 165.

This just uses 2 595's.  It can access all 18 address lines, 3 control lines and 8 data lines (input and output) using 16 of the available 18 pins on the Arduino.  Since it uses only 2 14-pin DIPs and a 32-pin ZIF socket, I think it'll fit onto a protoshield.  This is probably what I should have come up with last night.

I used a scanner this time, so you can see it a lot better.



One thing that bugs me about the Arduino though.  Why didn't they leave a single port unmodified?  Port D is almost clear, but the TX and RX for serial take the lower two bits.  It would have made interfacing with the data bus easier, at least software-wise.  I encountered this before when building an 8-bit DAC.  Oh well, there are enough pins, it'll just take a bit more work in software.

Grumpy_Mike

Quote
but the TX and RX for serial take the lower two bits.


These pins are dictated by the controller hardware it is not a choice the designers of the Arduino made. Same goes for the other "specialised" pins. It's something embedded engineers have to put up with. The newer chips with a processor embedded in an FPGA can get round this problem but they are not really suitable for this sort of board.

Yep that looks a better circuit. How about putting a counter in place of the shift registers, that will use fewer lines and most of the time you will want to access sequential locations in flash. Or do you need the address lines for the writing of 55s and AAs or is it not that sort of flash?

UziMonkey

I need the address lines to output commands as well as addresses.  A counter would work, but I would have to clock it all over the place to get the commands that are needed.

I'll actually look into that though, but it looks like the space on the protoshield is so limited, I won't be able to fit anything wider than an 8/14-pin dip.  I guess I won't really be limited by the number of chips, just the width of the chip.

I drew it out on paper, and a 32-pin socket (not ZIF socket) will barely fit on the protoshield board from Sparkfun.  You're left with just 4 holes of space next to the socket, which will fit DIPs as wide as 8 or 14-pin DIPs.  Anything wider won't fit.  Also, I'd need to find out how much wider the ZIF sockets are.  I could also just cut the traces on the 5v and gnd rails and get 2 extra rows, that should be enough space.

I wonder how wiring this thing will work?  I'd have to get some real fine gauge wire and do it all on the bottom.

I guess I can stop being mad at the Arduino designers then.  What are these new FPGA-based chips?  Do you just mean FPGA chips, or are they integrating FPGA into new microcontroller chips or something?

Grumpy_Mike

No it is a processor surrounded by an FPGA like the PSoC from cypress this can have pins configured a Capacitive sensors, uarts, I2C and so on. Most I/O lines can be made most things.
http://edageek.com/2008/12/04/cypress-edn-webcast/

While the PSoC is only a simple 8 bit processor the Vertex is a power PC surrounded by a very large FPGA. It is in a BGA package with just under 2000 connections. Do a google for "FPGA embedded processors", I am using one at work at the moment but the chips are about $400 each.

As to space you can always go longer or wider than the Arduino, I make my own using strip board or perf board:-
http://www.thebox.myzen.co.uk/Hardware/Arduino_Sheld.html
there's nothing to say the board has to stop at the edges of the arduino.
That I2C chip is a slim line dil package so it is quite space saving over two shift registers.

UziMonkey

It just occurred to me that any overhang a ZIF socket might have will probably be OK, as long as I solder the shift registers to the opposite side of the board.  At least then they won't be so tall, and as long as they don't hang down far enough to touch the Arduino.

You're referring to the MCP23016?  It does come in SPDIP (S implies skinny?) but it'll end up doing the same thing as the shift registers anyway.  And..  well, I understand the shift registers a lot better.

I guess I have a new complaint about the Arduino.  Why didn't they keep the spacing of the digital pin headers even so you can use any project board as a shield?  You did some crazy hole drilling on stripboard, but I think I can just bend the pins of the headers a little bit and plug in a project board.  I just did some test layouts on a project board and...  well, I have tons of space.  I just need to get it to mate.

Anyway, it looks like I was thinking all wrong about this.  I'll do more (right) thinking tonight.

Grumpy_Mike

Quote
Why didn't they keep the spacing of the digital pin headers


Either conspiracy to sell commercial shields or cockup and they had to keep it like that to maintain compatibility with shields already on the market.

I asked the question and was told cockup - I always find this more believable over conspicuous.   ;)

UziMonkey

I just found the Seeeduino.  It's like $25, and protoshield kit is about $20.  I can then re-use it for other projects with nice and cheap project boards.  It fixes the spacing on the digital pin headers and has a few other improvements.

UziMonkey

I got my shift registers yesterday, so I'm back on this now, in case anyone is wondering.  I'll probably blog about the shift registers today.  Only a small hiccup, but they worked just as I expected.

UziMonkey

Well...  I'm shocked.  It worked on the first try.



I'm reading the product ID back out of it correctly.  That tells me I have all the address and data pins hooked up correctly, as well as CE, WE and RE.  That's everything I need.  That was easier than I thought!

UziMonkey

And...  I'm even more shocked.  The flash chip pictured isn't working, I'm convinced it's broken.  But I'm successfully erasing and writing data to other flash chips.  This was a lot easier than I thought.

rbz

Hello!

I'm interested in re-creating this.

Do you have any further info? source code perhaps?

Thanks, Rob.

Go Up