Shop OBEX P1 Docs P2 Docs Learn Events
Using propeller to translate SPI/i2c SRAM and EEPROM for older CPUs? — Parallax Forums

Using propeller to translate SPI/i2c SRAM and EEPROM for older CPUs?

rwgast_logicdesignrwgast_logicdesign Posts: 1,464
edited 2014-12-09 14:54 in Propeller 1
Ive been looking around at a few classic trainer computers, Like the COSMAC ELF, and the z80 Micro Professor. I would like to build an SBC using mostly modern parts except the CPU. Old DIP SRAM is hard to source and EPROMS require special programmers, which make them both unappealing. It seems to me that using a micro controller like Propeller to translate between the CPU's parrallel bus and the i2C/SPI bus of the memory would not be to hard of a task to accomplish. Nut im wondering if using the propeller as a middle man would be a cause a huge slow down in the memmory access time between the CPU and Memory? Although we are talking about using an 80 mhz micro to translate to a 2-20mhz CPU depending on make and model of CPU chosen. Is this a dead end path? maybe better off learning and using a CPLD? Any suggestions for SPI to parallel translation are welcome.

Comments

  • Heater.Heater. Posts: 21,230
    edited 2014-12-06 03:51
    rwgast_logicdesign,

    Typical 8 bit era trainer and dev boards would have:

    1) 8 bit CPU. Z80, 6502, 6800 etc.

    2) A few kilobytes of RAM. My 6809 board only had 1K in two 4our bit wide chips.

    3) A few kilobytes of EPROM. Maybe a 2708 1K byte, or perhaps 2716 2K byte.

    4) UART

    5) Parallel port

    6) Interrupt controller.

    7) Hex key pad

    8) Six digit 7 segment display.

    Typical 8 bit computers, say an Intertec Superbrain, maxed out at 64K RAM and added video output and floppy drives.

    So how how about this idea...

    Take the 8 bit CPU of your choice and use Propellers as your RAM, ROM and peripherals.

    Each Prop provides up to 32K of memory space so two Props would max out you 8 bit address space already.

    Code loaded into a COG on each Prop would serve up the HUB memory over the Prop pins to the 8 bit CPU should be quite fast enough. Over clock the Props to 100+ MHz anyway.

    That leaves you with 14 COGs that can emulate those old, PIO, timers, interrupt controllers, floppy drives (on SD card) etc.

    Using all the RAM from a Prop for the 8 bitter seems a bit tight so how about just using 16K of it and have four Props for the full 64K.

    Now, I'd want a green screen text terminal so that will probably require a Prop of it's own as that uses lots of Pins and RAM.

    So there we have it. Old 8 bit CPU, 5 Prop chips and perhaps a little external logic for address decoding or whatever.

    This idea crosses my mind occasionally as I have a few 8080, z80 and 68000 chips waiting to see action here.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2014-12-06 12:49
    Thanks for the reply, sounds like a good idea to me. I have a 2mhz z80a chip around here somewhere, and one propeller chip not being used. That should be enough to get me started emulating RAM/ROM and a TTL interface to the the z80, along with the prop generating the clock for the z80? I've spent the last 3 years playing around with electronics everything from micros to amplifiers and RF, I really want to buckle down and get a good grasp on assembly and computer theory. Do you have any recommendations other than the z80 data sheet and all of the various prop tutorials and manuals?
  • jmgjmg Posts: 15,173
    edited 2014-12-06 14:35
    Old DIP SRAM is hard to source and EPROMS require special programmers, which make them both unappealing.

    I'm not quite following - there are plenty of DIP SRAMs still available ? - you just need to adjust your size to what suppliers offer. eg Digikey show 19 DIP SRAMs in stock, even up to 4MBit at a reasonable sub $5. (55ns 2.7-5.5V)
    32kx8 are now cheaper than smaller RAMs

    You could parallel EEPROM for CODE, or use some logic/SPLD to overlay CODE/RAM, and run a small loader.
    (eg run a Prop on the same BUS, and hold the old CPU in reset while the Prop loads the Code )
    If you choose an old CPU that is not too old, (ie Static CMOS, not dynamic NMOS) you may be able to single step it from the Prop control.
    With a little care, such dual memory sharing could be made quite nimble, for run-time use as well.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2014-12-06 15:48
    Hmmm maybe I just searched Digi-Key badly I could only find SPI/i2c SRAM or surface mount parallel ram.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-12-06 18:06
    I used 512KB SRAMs in DIP packages on my TriBlade. IIRC 32KB-512KB are all available in DIP. Try Future Electronics (not futureelec)
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2014-12-07 01:53
    Ok so I was digging through my stash of chips and I found this quite expensive jewel I have never had a use for http://www.maximintegrated.com/en/products/digital/memory-products/DS1265AB.html. It is an 8Mbit Non-Volatile SRAM 40 pin dip. Would I be able to acually use this thing for the memmory and an EPROM? It seems all I would have to do is use a prop to dump the z80 code in to a portion of its memory in order to use it as EPROM. Im guessing I just cant allocate any addresses on it that is bigger than the z80 will allow?
  • kwinnkwinn Posts: 8,697
    edited 2014-12-07 06:00
    That's a great chip for what you are doing. Use the propeller chip to load a bootstrap program into the ram and to control paging so you can address the entire megabyte of memory. Not too many pins left after that so you will probably need a second prop for I/O.

    What micro are you planning to use with it?
  • jmgjmg Posts: 15,173
    edited 2014-12-07 11:08
    .... It is an 8Mbit Non-Volatile SRAM 40 pin dip. Would I be able to acually use this thing for the memmory and an EPROM? It seems all I would have to do is use a prop to dump the z80 code in to a portion of its memory in order to use it as EPROM.

    Sure, that is the exact flow I described above.
    It would be nice to have a part that pricey doing some real work :)

    To save pins, you could Prop-load a very small Z80 stub, that then loads the rest of the code
    Im guessing I just cant allocate any addresses on it that is bigger than the z80 will allow?
    Not directly, but you can use Logic to Page swap, and that can allow simple extensions, and also help the Z80 loader approach.
    - for example, you can have a Boot-page, a 64K Code+Data (RUN) Page 1 and then you can swap-in 32k or 16k slices from higher memory, if you need more... depends really on what you want to emulate, or run, and what memory mapping scheme that uses.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2014-12-07 11:19
    Kwinn I plan to use a Prop or multiple props, along side a 4mhz z80. Although I am considering buying a CDP1802, the RCA chip from the ELF it is also a very interesting CPU, although not as powerful. For now I will go z80 since I have one on hand.

    Ok I have no idea what im doing lol, this is the first time ive worked with a parallel bus other than an LCD, and im not guite sure how exactly to share the memory between the prop, or get the z80 to page the FULL chip! Im sure figuring out how to get the z80 to page the chip will come in time as I learn more about the CPU, fortunately I have plenty of graphing calculators I can use as an ASM test bed, and I found this excellent basic tutorial http://lateblt.tripod.com/z80proj1.htm. I have also found about 8 old UV EPROMs and own and eraser, the only problem is they take 24v to program, so im thinking I may stik with the NVRAM as the EPROM.

    If I were to use the use the prop to program the the NVRAM chip instead of an EPROM, would I do something like connect the appropriate data and address lines to the prop and z80, and use some kind of a switch for programming mode? Im sure the propeller and the z80 can not share access to this chip at the same time? Since all im doing with the prop is programming some of the ram as "ROM" for the z80 im sure using something like i2c expanders (or shift registers) should be just fine no need for full speed access to the NVRAM chip from the prop? This way I could use the rest of the prop to emulate the PIO and clock?
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-12-07 16:08
    I used a similar SRAM battery backed device in the late 80's (an 8KB IIRC). While spec'd to last for 10+ years all devices in the field began failing at 5 years. Fortunately my devices had a small bootloader and were connected to the main computer via serial over stat muxes so we were able to reload code until they could be replaced with permanent code. I had >100 devices spread all over Australia.

    That said, they were fantastic when I started the rollout because I could remotely update the firmware as mods were required. Fortunately they were not that expensive (relatively).
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2014-12-07 19:18
    @Cluso, my biggest issue with this, is the "10" year time limit on the chip. Thats fine for the general RAM there is no real reason to use NVRAM other than I have this chip and I don't have a better use for it. But as far as storing the ROM on it, when it dies my computer wont have ROM anymore and ill either have to rework everything for a regular EPROM or spend 165 dollars to replace the thing. Even worse the pin format of the chip is not socket friendly.

    Ive been tearing up all kinds of old MOBOs looking for SRAM chip and can only find DRAM, I wish there was a way to use a battery backup, instead of the battery being built in to the chip.
  • kwinnkwinn Posts: 8,697
    edited 2014-12-07 20:10
    You can always add an external backup battery by having it connected to the board or just to the Vcc pin of the ram chip. You really don't need nvram or battery backed ram if it is only used for booting. On power up you can have the propeller write the boot program to the ram using the z80 address and control pins. That boot program could be stored in the propeller eeprom or an sd card. All the pins required to do that are also needed for the propeller to act as the I/O for the z80 so no wasted pins either.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2014-12-07 21:59
    Oh nice thinking, basically the same kind of system the propscope uses writing the program to the propeller every boot up! Now obviously a prop will work great for peripherals like, keyboard, serial, i2c, spi, vga etc. But exactly how hard will it be to emulate a PIO chip? is it worth the effort to keep it on the propeller or is buying a PIO the better option? This PIO thing is brand new to me coming from micros, and even ARM cpus with GPIO pins! It seems to me I cant test anything without a PIO, cant even blink an LED.
  • jmgjmg Posts: 15,173
    edited 2014-12-07 23:06
    A prop can manage the PIO pin tasks, but is more of challenge to 'look like' SRAM.
    The Z80 expects to just strobe RDN/WRN, and get some-ns level turnaround.
    A Prop alone cannot do that, but you could look at some tight time-domain co-operation.
    The Z80 has /BUSAK /WAIT /BUSRQ, and IIRC some designs used those for handshake bus designs.

    A SPLD/CPLD may be needed to run a state engine the Z80 and Prop can both work with.

    Parallel loaders can be quite small, (< 10 lines ASM) and one pin-saving method would be to have the Prop feed opcodes and data to the Z80, in a tight loop, controlling the Z80 clock to match the Prop feed rate.
    Once the RAM is loaded, the Prop can bump the clock up.
    For that approach, you would need a CMOS Z80 (static clock compatible)
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2014-12-07 23:15
    I have chip very similar to number 3 on this list http://brainstones.narod.ru/collection/zilog.htm the z logo is just smaller, I did a google search on the part number and didnt come up with much about it. I'm not sure if its CMOS or not all I know is it is supposedly 4mhz. Zilog/z8400A PS/Z80A CPU/8329
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2014-12-08 00:55
    This is the ram chip cluso was talking about http://www.futureelectronics.com/en/technologies/semiconductors/memory/static-ram/asynchronous/Pages/5985502-AS6C4008-55PCN.aspx?IM=0

    $3.33, it has data lines and address lines and works on both 3.3V and 5V works well with both the propeller as external ram, and with the Z80.

    Only thing is, it does get a bit tricky if you wanted to use a propeller and a Z80 and this ram chip all on a common bus, because the Z80 is 5V. So lots of 2k7 resistors to do the level translation. Ditto using a Z80 and using the propeller as the ram.

    Keep hacking - this sounds a fun project :)
  • jmgjmg Posts: 15,173
    edited 2014-12-08 01:38
    Dr_Acula wrote: »
    Only thing is, it does get a bit tricky if you wanted to use a propeller and a Z80 and this ram chip all on a common bus, because the Z80 is 5V. So lots of 2k7 resistors to do the level translation. Ditto using a Z80 and using the propeller as the ram.

    Best to avoid 5V, and use 3.3V everywhere.

    I see Mouser claims stocks of CMOS Z8S18020PSG, in DIP60, ( & also PLCC68)
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2014-12-08 02:36
    Ok so Ive been thinking about this, lets say I decide to stick with my 1M NVRam now there are 20 address lines and 8 data lines on this chip. Basically Im thinking I would want to connect the z80 to address lines 0-15, and the 8 data lines of course. Now the z80 would only be able to address the first 64KB of RAM. The propeller on the other hand can address the whole chip with no pins to spare. But basically what I would do is is use the propeller to do is write above the RAM above the first 16bits and move that data down to the lower 16bits of address space. Is this the basic idea of how to set up a paging system for the z80 to access the whole 1Mb?

    Secondly as I stated above there would be no pins to spare on the propeller, so if I were to communicate to the ram through some 74xx595 shift registers I could save a whole lot of propeller pins, is this a "good" way to access parallel ram with a prop? I mean these SRAM chips you guys are linking to are 55ns, and the data sheet says a 74HC595 is 5.4ns so will there be any significant speed impact especially on an old 4mhz cpu? I mean a prop pin can toggle at 12ns and the shift register is 5.4ns and the ram is 70ns, so were looking at an 87.4ns access time? wouldnt a 4mhz cpu take 250ns to access ram anyways?

    Im probably totally wrong about all this, just trying to figure it out so I have some sort of idea if im going down the wrong path here.
  • kwinnkwinn Posts: 8,697
    edited 2014-12-08 08:15
    Take a look at the Mini80 project at http://www.shaels.net/ for a starting point. It uses a Z80, 512KB sram, and a propeller to create a complete system that can run CPM. The propeller chip provides the bootstrap loader, VGA, keyboard, and SD interfaces. Only 64KB of the ram is used by the system but it would be simple to add a '373 or similar latch as a page register to access all of your sram.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2014-12-08 22:30
    Cool project! Looks like it will be really helpful, read through it, really need to brush up on how the z80 works. I love the fact you can dynamically slow the clock down, id love to have an Altair type panel using old HP bubble displays and switches, being able to clock the chip down to a few Hz or stop it dead in its tracks seems like an awesome debugging system.

    Looking at the micro80 schematic I am a little confused about something

    http://www.shaels.net/uploads/Media/SiteDownloads/Mini80/Mini80Proto1.pdf

    Is he using the shift register to address only the first 8 address lines of the ram chip?

    The more I think about this 1M Ram chip the cooler it seems maybe I could somehow load CP/M on to the whole thing and run it directly from RAM that would be pretty quick! Also if anyone could tell me if I'm calculating all the ram timing right in my last post, and if not how would I go about figuring that out?
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2014-12-09 01:56
    shael looks like he is using the shift register to send in a little bootstrap program into the ram chip. So that doesn't matter if it is rather slow. Once there is a program in ram, even if it is just a few bytes, you can use that to talk at faster speeds.

    Re using shift registers to save propeller pins, yes it will work, but it will slow things down 20-30x so that wouldn't be so good. Anything less than about 4Mhz gets a bit tedious waiting for WordStar and compiling C and Basic programs.

    Yes, once you get something working with the first 64k of ram, you can think about banked memory. Lots of options there, ranging from switching in 32k blocks, to having 4k blocks of ram all individually movable to anywhere in the 64k space (I did that on a fpga, but it would be quite a few chips to do in real life).

    Build something simple first - shael's project looks a great place to start.
  • kwinnkwinn Posts: 8,697
    edited 2014-12-09 08:15
    The '165 is a parallel to serial register so he is using it for the prop to read the state of address lines A0 to A7 and M1. Probably for I/O since A0 to A7 are the address lines used to specify one of 256 possible I/O ports on the Z80.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2014-12-09 11:20
    Hmm well I found 2 16Kb SRAMs that will work as battery backed NVRAM down to two volts, this seems like a good idea for the EEPROM, and I also found some proper 64KB SRAM chips. I also found s bunch of transparent latches. So for now I will just start with the basics until I have a deeper understanding of whats going on, but I would really like to implement this 1MB NNVRAM chip as a RAM disk or something later down the road. Thank you guys for all the ideas though.

    I just have one question left, why does addressing the ram with shift registers slow things down so much, as I said the data sheet says they work at 5.4ns that's pretty quick? What is the best way to save prop pins and still talk to parallel ram, without a huge speed hit?
  • kwinnkwinn Posts: 8,697
    edited 2014-12-09 14:54
    It's not the speed of the shift register, it's the speed of whatever is shifting out the data. In this case, the propeller chip. At 80MHz a cog takes 50nS to perform an instruction. To shift out a bit of data takes at least 3 instructions, one to put the data out on a pin, one to set the clock pin high, and one to set it low, plus two instructions to transfer the data to the output latches. That's 150nS per bit, or 1.3uS total for 8 bits. Not 100% sure but that might be long enough that a 4MHz Z80 would have to pause to allow the new address and data to be valid.
Sign In or Register to comment.