View Full Version : Data parallel buses
09-05-2007, 11:31 PM
Hello, well, you know some tutorial / page with some information for working with parallel data buses? For example, EPROM's, SRAM's, or something of the such.
Whatever a tutorial for using such thing on a PIC or similar microcontroller, it would be VERY appreciated.
All I found were serial EEPROM tutorials. Nothing else. :-(
09-06-2007, 01:57 AM
To use such a device, you just need to first place the address, assert /CE, then if you're reading, assert /OE (then grab the data at the data bus), or if you're writing, place data on the data bus and assert /WE. It's that simple! Just obey the timing constraints.
/CE is the master enable. It allows you to use /OE (turns tri-state mode on data bus into outputs) or /WE (turns tri-state into inputs).
For EPROMs you need a special programming voltage needed to blow fuses (make a bit a 0). For EEPROM it's just like SRAM. For Flash you need special programming algorithms that depend on the specific device.
Edit: I should add that most MCU like PIC only have serial I/O, so it's really not practical to use parallel memory devices. If you really must, you could always use fancy bidirectional shift registers for data bits (and address/control or use counters for them) but that's pretty expensive and would be really slow since it'd be really tedious getting data in and out serially.
09-06-2007, 06:35 AM
The only practical way to interface a PIC and say a SRAM or EEPROM is to either latch addresses into several shift registers, or integrate the shifters into a CPLD which would be cleaner.
A PIC is really not meant to handle lots of I/O. A good starter kit would be a certain LPC2138 board, these are ARM chips and can run pretty fast, and have lots of I/O. They are also surface-mount.
I would consider interfacing to CompactFlash card (possible with a pic16f877) or a SD card. You can google around and there are several tutorials/examples available.
Maybe if you describe what you're trying to accomplish, I can recommend something.
09-06-2007, 02:04 PM
Well, thank you to you both.
What I want to acomplish is writting and reading to a paralel data bus. Like, reading a byte from a EPROM, or writing to a SRAM.
About the PIC not being appropiate, I'll look at some other microcontrollers.
And calpis, thanks a lot. Then it should be something like this: I want to read a byte on the first bank:
I pull CE high.
I pull A0 high.
I pull OE high.
Then I read the byte from D0 to D7. I am right or wrong?
Thank you :D
09-06-2007, 07:23 PM
Not quite, you want to normally keep /CE and /OE high (inactive), to use it you must pull it low because it's /CE (the "/" denotes active low or an inverted input). /CE is needed so you can have multiple devices on the same data bus. To select the one to use, assert only that one's /CE. All ROM/SRAM's /OE should be connected together. If you make multiple devices output at the same time, you will have a bus conflict which could theoretically damage hardware. Even if there's only one device, it's a good idea to not keep /CE active when it's not being used because often chips have a low-power mode used when the chip is not selected!
To read the first byte from a ROM:
- pull A0-An low
- pull /CE low
- pull /OE low
- wait for the speed of the ROM
- read data
To read the second byte do the same thing but A0 should be pulled high instead of low.
If you're going to do a project just to learn, why not make a game cart dumper? You can use the PC's parallel port and use games instead of EPROMs or SRAM. This is a useful and cheap project if you have some programming experience.
09-06-2007, 09:52 PM
Oh, I'm used to recognise low signals with ! xD.
And okay, thanks. About the cart dumper idea, yeah I could do that.
The address thing does confuse me a bit.
Imagine that I want to read a 8 mega bit cart (or a 8 mega bit EPROM). I know that it is organised in a role of 1 mbit * 8 bits. But, how do I know which address to pull low / high to read the desired byte?
Calpis, you're helping me a lot. Thanks a lot! :D :D :D
09-06-2007, 11:25 PM
For an 8Mbit ROM, there are 20 address lines or "bits". 2^20 = 1048576, 1048576 x 8 bits = 8 megabits. To read address X, just apply address X to the address lines. A0 is the least significant bit, A19 is the most significant.
09-07-2007, 01:17 AM
Oooh, I think i finally get it. For example, I want to read address FFFFFF (xD), I should do this:
Pull A19 low.
Pull CE low.
Pull OE low.
Read from the bus.
I am right? :D
Thanks a huge lot. You are awesome. Seriously.
09-07-2007, 03:18 AM
Yes, that should do it. If you want to dump the whole thing, just increment a counter by 1 each iteration. You'll have to bitshift the bits in groups of 8 to each port on your MCU.
If you want a MCU with lots of I/O and easy programming, sample a Cypress EZ-USB FX2. If you get the 100-pin tqfp, you get 40 I/O pins and it goes up to 48MHz, based on a 8051 core. You just wire it up to a USB socket and a 24mhz crystal, and 3.3v power source.
Since your code is contained in 16kb of ram, programming happens in a split-second and automatically resets your chip.
I'm sure you've seen destop's yan64bu. You can check the schematic to see how to wire it up.
09-07-2007, 07:40 AM
I don't think you're getting it. 0xFFFFFF is byte 16777215 decimal, 0xFFFFF is the highest address in a 8M ROM. Address bits are active high. To read address 0x01234 you place this on the address bus:
0x0 1 2 3 4
0000 0001 0010 0011 0100
09-07-2007, 01:12 PM
Okay, I don't get it. :'( Fuck.
I asked a friend that was doing informatical engineering and he told me that:
For getting the address you want to use, do: SD[DI], making a pointer on the first stack and moving it to the desired address... I don't get that.
Shit, I blame my silliness.
09-07-2007, 06:39 PM
Do you understand the number systems (decimal/binary/hex)? It's really very easy, look closely at my diagram. Just take the address you want to access, change it into binary, apply it to the address lines. To make any access, you must pull EACH address line high or low.
This is why it's not a terribly good idea to use parallel buses with modern microcontrollers with few I/O. Old microcontrollers like the 8051 which were designed when EPROM was the only firmware storage, support external ROM/RAM naturally. Now the relatively large memory inside the chips makes it pretty unnecessary to have external devices and so they dropped that stuff in favor of having 8 pin devices.
09-08-2007, 09:18 PM
Then, for accesing A1CD26 I should do:
1010 0001 1100 1101 0010 0110
09-09-2007, 04:17 AM
09-09-2007, 04:34 PM
THANKS! THANKS! YOU'RE AWESOME.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.