---
+ Post New Thread
Results 1 to 7 of 7
  1. #1
    Newbie level 3
    Points: 291, Level: 3

    Join Date
    May 2011
    Posts
    3
    Helped
    0 / 0
    Points
    291
    Level
    3

    Programming parallel EEPROM AT28C256 with Arduino...

    Hello,
    I'm building an 8-bits computer with old cpu (for educational purpose).
    Now, to make it work, I need a ROM that I will fill with all kinds of
    stupid or smart code.
    But I don't have any *PROM programmer.
    Looking at Atmel parallel EEPROM AT28C256 (32 KB), I read in the datasheet (http://www.atmel.com/dyn/resources/p...ts/doc0006.pdf) that it could be programmed with +5 V.
    So I thought that I could be able to program it with my microcontroller (Arduino Mega), then plug it to my 8-bits cpu. Et voilà!
    Et no voilà...
    I'm stuck with the first part - program the EEPROM with the Arduino.
    I've spent hours trying to make it work, and I don't know if it's my design that's flawed, or something else (the moon, maybe..).

    Here is my attempt.
    - for a start, I wanted something very simple, so I only use 3 bits of the address bus : A0, A1 & A2. A3 to A14 are connected to GND of the Arduino.
    I only want to write and retreive data to/from addresses 0 to 7 (very short program indeed! Just to check it's working, and less wiring)
    - A0 .. A2 are connected to 3 digital pins, as outputs
    - D0 .. D7 are connected to 7 digital pins, as outputs or inputs, depending on the action (writing to the EEPROM, or reading - to check)
    - VCC is connected to the Arduino's VCC
    - GND to the A's VCC
    - CE, OE & WE are connected to 3 digital pins
    - I use a breadboard

    Here is the init sequence:
    - set A0..A2, WE, OE and CE to output
    - set WE/OE & CE to 1 (+5V)
    - wait 1.5 sec

    Now the write sequence:
    - set D0..D7 to output
    - for each byte to write:
    . set OE to 1, CE to 0
    . write A0..A2
    . write D0..D7
    . set WE to 0
    . wait for x ms (I've tryed lots of different values)
    . set WE to 1, CE to 1

    And the read sequence:
    - set D0..D7 to input
    - for each byte to read:
    . set CE to 0
    . write A0..A2
    . set OE to 0
    . wait for x ms (I've tryed lots of different values)
    . read D0..D7
    . set OE to 1, CE to 1

    When I do the write then the read sequence, I have trouble with the first byte, which is different between read & write (very often, I read 255, sometimes 127). The other bytes are fine (ie same as written : I write 0 to 7 in ROM addresses 0 to 7, it's easy to check).
    If I set a longer wait time for the read sequence, I get the correct value (but 4 ms for a memory read seems eternity...)
    But the worst part is : when I reset and only read bytes from the EEPROM, I get data that has nothing to see with my initial data.
    For example : 255,255,255,223,4,127,4,255 instead of 0 .. 7.

    Does somebody understand what is going on ? What I could try ? If my design is correct ?

    Thank you for reading my (way too) long post, I hope to read from you !

    Boz

    •   Alt31st May 2011, 04:29

      advertising

        
       

  2. #2
    Full Member level 4
    Points: 1,209, Level: 7

    Join Date
    May 2011
    Location
    NY
    Posts
    192
    Helped
    47 / 47
    Points
    1,209
    Level
    7

    Re: Programming parallel EEPROM AT28C256 with Arduino...

    For reprogramming or programming an EEPROM. The erase voltage is typically different so you will probably need a prom programmer to start with. That having said, you could try getting UV EPROM which are cheap (if they are available still).



  3. #3
    Newbie level 3
    Points: 291, Level: 3

    Join Date
    May 2011
    Posts
    3
    Helped
    0 / 0
    Points
    291
    Level
    3

    Re: Programming parallel EEPROM AT28C256 with Arduino...

    Hello.
    Don't know what happened, I thought had replied to this thread, but I can't find my message anymore !
    I've read in the EEPROM documentation that the "erase" function requires a +12V voltage. I did'nt know how
    EPROM/EEPROM programming worked (erasure setting all bits to 1, programming turning 1s to 0s). Now I know
    better! Thank you for your help.



    •   Alt8th June 2011, 13:47

      advertising

        
       

  4. #4
    Newbie level 2
    Points: 196, Level: 2

    Join Date
    Nov 2011
    Posts
    2
    Helped
    0 / 0
    Points
    196
    Level
    2

    Re: Programming parallel EEPROM AT28C256 with Arduino...

    Hi,

    I am trying to do the exact same thing. I want to use my arduino mega to program an eeprom. I bought a Xicor 28c256 that has the same datasheet info as the Atmel because it says it is accessed the same as SRAM.

    I tried it before I found this post, and my arduino code ended up looking very similar to the program bozgrul describes. No matter what I try, I can only get it to read back 255. When i swap out the eeprom with an SRAM chip it reads and writes like a champ so i assume my program is fine.

    You say you solved it by using the 12v erase option... I guess I dont understand why would I need to hook up 12v when i could just program each address over with whatever i want at 5V? (I have 12V avail and will give that a try later I guess...)

    I am aware of the software data lock option in the datasheet, but it says it ships with it off. I have tried a few different eeproms from the same shipment just in case. I also tried unlocking the software unlock code, but I have low faith in this since it may require precise timing that the arduino cant give it.

    Any pointers would be greatly appreciated.



  5. #5
    Newbie level 3
    Points: 291, Level: 3

    Join Date
    May 2011
    Posts
    3
    Helped
    0 / 0
    Points
    291
    Level
    3

    Re: Programming parallel EEPROM AT28C256 with Arduino...

    Hi gokustar.

    Well, in fact I didn't solve it, just understood what was wrong in my design.
    It seems that with the EEPROM I have, I don't have the choice : it can only be erased using 12V.
    I didn't know how EEPROM worked, so I misread the datasheet.
    I only gave a quick look at the datasheet of your EEPROM, didn't find useful information (but definitely,
    you don't need 12V with this little fellow).

    The fact is, I wanted to program the EEPROM like programming a non-volatile RAM, which didn't work.
    Don't know if it will help you, but this how it seems it work:
    - first you have to erase (if it's not already the case) the bytes you want to modify (on my EEPROM, it's a specific operation, different than simple writing)
    - it will reset all those bytes to $FF
    - then you write the bytes you want to modify, like a regular RAM. The fact is : 1's can be erased and turned to 0's, but not the other way around (that's why you need to erase the bytes first). So if you write $FE, it will set the last bit to 0. Latter, you can set the same byte to $F0, but not back to $FF.
    I hope I understood it well, I'm a newbie in this field...

    Well, I'd like to get one of those Xicor ! I've given up my electronic contraptions, because of this problem, but I'd like to get back to them!
    Problem is, I live in France, and I can't find everything I want online without ordering in US shops (from Jameco, which costed me an arm in shipping, twice the price of the parts I had ordered...). If I could find a european shop, it would be fine...

    I will take a look tonite at your datasheet.

    bozgrul

    Quote Originally Posted by gokustar View Post
    Hi,

    I am trying to do the exact same thing. I want to use my arduino mega to program an eeprom. I bought a Xicor 28c256 that has the same datasheet info as the Atmel because it says it is accessed the same as SRAM.

    I tried it before I found this post, and my arduino code ended up looking very similar to the program bozgrul describes. No matter what I try, I can only get it to read back 255. When i swap out the eeprom with an SRAM chip it reads and writes like a champ so i assume my program is fine.

    You say you solved it by using the 12v erase option... I guess I dont understand why would I need to hook up 12v when i could just program each address over with whatever i want at 5V? (I have 12V avail and will give that a try later I guess...)

    I am aware of the software data lock option in the datasheet, but it says it ships with it off. I have tried a few different eeproms from the same shipment just in case. I also tried unlocking the software unlock code, but I have low faith in this since it may require precise timing that the arduino cant give it.

    Any pointers would be greatly appreciated.



  6. #6
    Newbie level 2
    Points: 196, Level: 2

    Join Date
    Nov 2011
    Posts
    2
    Helped
    0 / 0
    Points
    196
    Level
    2

    Re: Programming parallel EEPROM AT28C256 with Arduino...

    Thank you for your reply!

    looking at the data sheets we have almost the same chip by 2 different manufacturers. the atmel lists the 12v erase sequence, mine does not mention it except saying it is 5V only for operations. mine wont write no matter what i try, at least you got yours to write a few times. i have 12v available so i will probably order one of the atmel chips so i can see if that helps.

    i am trying to do something similar in function to you if you were building a computer, i want to be able to program the chip from my pc via the arduino and then test it in a circuit, so i will be re-programming it quite often as i test everything. once i get my sequence figured out it would be read only in the final circuit.

    i still wish i could figure out what i am doing wrong with the xicor. ill update if i figure it out.



  7. #7
    nib
    nib is offline
    Newbie level 1
    Points: 13, Level: 1

    Join Date
    Oct 2014
    Posts
    1
    Helped
    0 / 0
    Points
    13
    Level
    1

    Re: Programming parallel EEPROM AT28C256 with Arduino...

    I ran across this exact problem trying to program Xicor 28C256 EEPROMs with an Arduino. I tried multiple parts with no success and my setup worked fine with an SRAM in place of the EEPROM. It turns out that the new chips were write protected, even though the datasheet clearly says that they shouldn't be.

    This was solved by writing the 6-byte unlock code. To do this, just do the 6 writes in a row - don't do the normal programming operation of waiting for confirmation or time out. I used code like this:

    Code C - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    
    // Set an address and data value and toggle the write control.  This is used
    // to write control sequences, like the software write protect.  This is not a
    // complete byte write function because it does not set the chip enable or the
    // mode of the data bus.
    void setByte(byte value, word address)
    {
        setAddress(address);
        writeDataBus(value);
        
        delayMicroseconds(1);
        enableWrite();
        delayMicroseconds(1);
        disableWrite();
    }
     
    // Write the special six-byte code to turn off Software Data Protection.
    void disableSoftwareWriteProtect()
    {
        disableOutput();
        disableWrite();
        enableChip();
        setDataBusMode(OUTPUT);
     
        setByte(0xaa, 0x5555);
        setByte(0x55, 0x2aaa);
        setByte(0x80, 0x5555);
        setByte(0xaa, 0x5555);
        setByte(0x55, 0x2aaa);
        setByte(0x20, 0x5555);
     
        setDataBusMode(INPUT); 
        disableChip();
    }



+ Post New Thread
Please login

LinkBacks (?)

  1. 15th June 2013, 22:15
  2. 7th October 2012, 15:10