Shop OBEX P1 Docs P2 Docs Learn Events
Need help making an EEPROM programmer. — Parallax Forums

Need help making an EEPROM programmer.

pooboy_92pooboy_92 Posts: 3
edited 2012-08-21 02:17 in Propeller 1
Hi this is my first post on this forum so if it is in the wrong spot I apologize.

I have a 40 pin DIP propeller and am looking to program an EEPROM with a hex file I have on my computer. This EEPROM is going to be used on a z80 computer that I have been building for awhile now. I would just buy a programmer but at the moment I cant afford one and while I can work my way through z80 asm in mot very good with spin or prop asm. What I was thinking of doing was storing the hex in an array and then having the propeller set the address and the data lines properly then set the write enable on the EEPROM. So I was wondering if anyone could give me some source code to help me out. I am aware that the EEPROM is 5V and the propeller is 3.3 volt I have enough transistors to do the level conversion so that is not a problem. I will list the EEPROM model number and a copy of the hex file below, any help is welcome. If you need anymore information please comment below and I will gladly reply.


EEPROM - Atmel AT28C64B

This is the link to the hex file, if anyone has a problem downloading it I can put it on paste bin. I have also attached a zipped version below in case the dropbox link doesn't work.

https://www.dropbox.com/s/6oa0y2mcph36ve2/arduino test.hex


Thanks you

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-20 20:24
    The address and control lines of the AT28C64B don't need buffering since they're inputs and their voltage levels (Vih = 2.0V) are compatible with the Propeller's outputs. The I/O lines will need buffering. Something like a 74LVC245 will do very nicely. It should be easy to write a Spin program to program this EEPROM. The EEPROM itself will take care of the timing for you. It's just a matter of presenting the address and data bits and initiating a write cycle one byte at a time, then waiting for the EEPROM to signal that it's done (see the AT28C64B datasheet for details). After programming the whole thing, you can go back and read the EEPROM the same way to verify it.

    If you setup the I/O pins for convenience, the whole operation will be easy. Use P0-P12 for address lines, P16-P23 for data lines (to the 74LVC245). You could use P14 for the 74LVC245 DIR line and P15 for the /OE line. P24 would be the AT28C64B /CE line, P25 the /OE line, P26 the /WR line, and P27 the RDY line. P13 would be a spare. You'll want pullup resistors on all the control lines (/OE, /WR, /CE). 10K would work fine. You'll need a pullup resistor on RDY too since it's open-drain.

    You could use Spin or C for writing the programming program. For that matter, you could use FemtoBasic which would be very slow, but would work.
  • pooboy_92pooboy_92 Posts: 3
    edited 2012-08-20 20:32
    Thank you for the input Mike, I'm glad to know I will only need to do level conversions for the data lines. I believe that I can muddle my way through most of the programming, however I am stuck on how to store the data in an array and output it on the IO pins.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-20 21:16
    I would write a PC program in some familiar programming language that would read the hex file and convert it to SPIN source code for inclusion in a DAT section BYTE array, maybe 8 bytes per line of text.
    BYTE   $00, $00, $00, $00, $00, $00, $00, $00
    
    You'd just cut and paste this into a DAT section in your program with a label (like "table") on a BYTE statement in front. You'd need to set up the 74LVC245 control lines and the AT28C64B control lines first so you don't destroy some I/O pins by having two outputs connected to each other, then just do
    OUTA[23..16] := table[address]   ' set output register
       DIRA[23..16]~~   ' make output
       OUTA[12..0] := address   ' should already be set to output mode
    
    Now you can fiddle with the various control lines to actually write the data to the EEPROM. All of this is in a REPEAT address FROM 0 TO 8191 loop to cycle through all of the addresses. Remember to change P23-P16 back to inputs after the write cycle is complete and turn off /OE on both the 74LVC245 and the AT28C64B.
  • pooboy_92pooboy_92 Posts: 3
    edited 2012-08-20 21:48
    Thank you very much I will have to try that in the morning as it is late here Ill post my results when I'm done. :smile:
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2012-08-21 02:07
    I will have to do something like this too. I have a couple of CMOS Z80s in the garage, and I keep hearing them calling to me during the night.

    I did have a KISS EPROM programmer, but did that "I haven't used it for a couple of years, so pulled it apart" bit. which was mostly brought on by a "WILL YOU CLEAR OUT ALL OF THAT JUNK" "request". Plus the fact that it wouldn't run on anything higher than Win98. Still got the UV lamp though.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-08-21 02:17
    I will have to do something like this too. I have a couple of CMOS Z80s in the garage, and I keep hearing them calling to me during the night.

    I did have a KISS EPROM programmer, but did that "I haven't used it for a couple of years, so pulled it apart" bit. which was mostly brought on by a "WILL YOU CLEAR OUT ALL OF THAT JUNK" "request". Plus the fact that it wouldn't run on anything higher than Win98. Still got the UV lamp though.

    Personally I would make the Prop emulate an EPROM itself as long as the reset time of the Z80 system is longer than the boot time of the Prop. A simple bit of PASM will read the address lines and output the corresponding data as the cycle time of the old EPROMs is quite long compared to the Prop. Another bonus is it is very simple to have a cog running as a memory monitor and hex loader over the serial port.
Sign In or Register to comment.