Arduino based EPROM Programmer

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderators: B00daW, Moderators

User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: Arduino based EPROM Programmer

Post by FARID » Wed Aug 26, 2020 9:32 am

I made a shield for arduino uno.
I could use 250K baud rate for serial speed.
Read, blank check, compare of For 27C080 [1MB] takes 41sec!

C# Code :

Code: Select all

using System;
using System.IO;
using System.IO.Ports;
using System.Threading;
using System.Windows.Forms;

namespace EPROM_Programmer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        //////////////////////////////global variables//////////////////////////////            
        SerialPort Serial;
        int i, j;
        int eprom_size;
        byte[] eprom_data;
        int buffer_size = 1024;
        byte[] buffer_data = new byte[1024];
        byte[] file_data;
        int time;
        string response;

        //////////////////////////////form load//////////////////////////////
        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox2.Enabled = false;
            btn_read.Enabled = false;
            btn_check.Enabled = false;
            btn_write.Enabled = false;
            btn_compare.Enabled = false;
        }

        //////////////////////////////select eprom//////////////////////////////
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedIndex)
            {
                case 0: eprom_size = 8192; break;       // 2000Hex = 8KB = 27C64
                case 1: eprom_size = 16384; break;      // 4000Hex = 16KB = 27C128
                case 2: eprom_size = 32768; break;      // 8000Hex = 32KB = 27C256
                case 3: eprom_size = 65536; break;      // 10000Hex = 64KB = 27C512
                case 4: eprom_size = 131072; break;     // 20000Hex = 128KB = 27C010
                case 5: eprom_size = 262144; break;     // 40000Hex = 256KB = 27C020
                case 6: eprom_size = 524288; break;     // 80000Hex = 512KB = 27C040
                case 7: eprom_size = 1048576; break;    // 100000Hex = 1MB = 27C080
            }
            eprom_data = new byte[eprom_size];
            file_data = new byte[eprom_size];
            comboBox2.Enabled = true;
        }

        //////////////////////////////select port//////////////////////////////
        private void comboBox2_DropDown(object sender, EventArgs e)
        {
            comboBox2.Items.Clear();
            string[] ports = SerialPort.GetPortNames();
            comboBox2.Items.AddRange(ports);
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            Serial = new SerialPort(comboBox2.Text, 250000, Parity.None, 8, StopBits.One);
            //Serial = new SerialPort(comboBox2.Text, 57600, Parity.None, 8, StopBits.One);

            Serial.ReadBufferSize = 2097152;
            Serial.ReadTimeout = 2000;
            btn_read.Enabled = true;
            btn_check.Enabled = true;
            //btn_write.Enabled = true;
            btn_compare.Enabled = true;
        }

        //////////////////////////////read eprom//////////////////////////////
        private void btn_read_Click(object sender, EventArgs e)
        {
            try
            {
                Serial.Open();
            }
            catch
            {
                MessageBox.Show("Could not open the COM port!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Thread.Sleep(1000);
            Serial.Write("<READ>");

            try
            {
                response = Serial.ReadLine();
            }
            catch (TimeoutException)
            {
                MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Serial.Close();
                return;
            }

            if (response != "OK\r")
            {
                MessageBox.Show("Response Error!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                Serial.Write(eprom_size.ToString());

                progressBar1.Maximum = eprom_size;
                time = 0;
                timer1.Start();

                for (i = 0; i < eprom_size; i++)
                {
                    try
                    {
                        eprom_data[i] = (byte)Serial.ReadByte();
                    }
                    catch (TimeoutException)
                    {
                        MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        Serial.Close();
                        timer1.Stop();
                        return;
                    }
                    progressBar1.Value = i;
                    Application.DoEvents();
                }
                
                String filename = DateTime.Now.ToString("yyyy-MM-dd HH-mm ") + comboBox1.SelectedItem.ToString() + ".bin";

                using (BinaryWriter writer = new BinaryWriter(File.Open(filename, FileMode.Create)))
                    writer.Write(eprom_data);

                Serial.Close();
                timer1.Stop();

                MessageBox.Show("Reading EPROM was successful!", "Read EPROM", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        } // read eprom

        //////////////////////////////blank check//////////////////////////////
        private void btn_check_Click(object sender, EventArgs e)
        {
            try
            {
                Serial.Open();
            }
            catch
            {
                MessageBox.Show("Could not open the COM port!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Thread.Sleep(1000);
            Serial.Write("<CHECK>");

            try
            {
                response = Serial.ReadLine();
            }
            catch (TimeoutException)
            {
                MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Serial.Close();
                return;
            }

            if (response != "OK\r")
            {
                MessageBox.Show("Response Error!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                Serial.Write(eprom_size.ToString());

                progressBar1.Maximum = eprom_size;
                time = 0;
                timer1.Start();

                for (i = 0; i < eprom_size; i++)
                {
                    try
                    {
                        eprom_data[i] = (byte)Serial.ReadByte();
                    }
                    catch (TimeoutException)
                    {
                        MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        Serial.Close();
                        timer1.Stop();
                        return;
                    }

                    if (eprom_data[i] != 0xFF)
                    {
                        Serial.Close();
                        timer1.Stop();
                        MessageBox.Show("The EPROM is NOT blank!", "Balnk Check", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    progressBar1.Value = i;
                    Application.DoEvents();
                }

                Serial.Close();
                timer1.Stop();

                MessageBox.Show("The EPROM IS blank!", "Balnk Check", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        } // blank check

        //////////////////////////////write eprom////////////////////////////// 
        private void btn_write_Click(object sender, EventArgs e)
        {

        } // write eprom

        //////////////////////////////compare eprom//////////////////////////////
        private void btn_compare_Click(object sender, EventArgs e)
        {
            int mismatch = 0;

            openFileDialog1.Filter = "Binary files |*.bin";
            openFileDialog1.FileName = "ROM.bin";
            openFileDialog1.ShowDialog();

            try
            {
                file_data = System.IO.File.ReadAllBytes(openFileDialog1.FileName);
            }
            catch(System.IO.FileNotFoundException)
            {
                MessageBox.Show("Could not open the file!\nPlease select a binary file to comapre with EPROM.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
                        
            try
            {
                Serial.Open();
            }
            catch
            {
                MessageBox.Show("Could not open the COM port!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Thread.Sleep(1000);
            Serial.Write("<COMPARE>");

            try
            {
                response = Serial.ReadLine();
            }
            catch (TimeoutException)
            {
                MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Serial.Close();
                return;
            }

            if (response != "OK\r")
            {
                MessageBox.Show("Response Error!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                Serial.Write(eprom_size.ToString());

                progressBar1.Maximum = eprom_size;
                time = 0;
                timer1.Start();

                for (i = 0; i < eprom_size; i++)
                {
                    try
                    {
                        eprom_data[i] = (byte)Serial.ReadByte();
                    }
                    catch (TimeoutException)
                    {
                        MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        Serial.Close();
                        timer1.Stop();
                        return;
                    }

                    progressBar1.Value = i;
                    Application.DoEvents();
                }

                Serial.Close();
                timer1.Stop();

                for (i = 0; i < eprom_size; i++)
                {
                    if (eprom_data[i] != file_data[i])
                        mismatch++;
                }

                if(mismatch == 0)
                {
                    MessageBox.Show("The file and EPROM are identical!", "Compare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(mismatch.ToString() + " mismatch found!", "Compare", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }                
            }
        } // compare eprom

        //////////////////////////////timer//////////////////////////////
        private void timer1_Tick(object sender, EventArgs e)
        {
            label3.Text = string.Format("Elapsed time : {0:00}:{1:00}", time / 60, time % 60);
            time++;
        }
    }
}
Arduino code :

Code: Select all

#define clk 10
#define rst 11
#define rw 12
#define ce 13

unsigned long i;
int j;
unsigned long eprom_size;
byte eprom_data;
int buffer_size = 1024;
byte buffer_data[1024];
String command;
//=========================================
void setup()
{
  Serial.begin(250000);

  // eprom disabled
  pinMode(ce, OUTPUT);
  digitalWrite(ce, HIGH);

  // read mode [EPROM_VCC ==> 5v , VPP ==> GND]
  pinMode(rw, OUTPUT);
  digitalWrite(rw, LOW);

  // address lines ==> 0
  pinMode(rst, OUTPUT);
  digitalWrite(rst, HIGH);

  // clock ready
  pinMode(clk, OUTPUT);
  digitalWrite(clk, HIGH);
} // setup
//=========================================
void loop()
{
  command = Serial.readString();

  if (command == "<READ>")
    read_eprom();

  if (command == "<CHECK>")
    check_eprom();

  if (command == "<WRITE>")
    write_eprom();

  if (command == "<COMPARE>")
    read_eprom();
} // loop
//=========================================
void read_eprom()
{
  Serial.println("OK");
  while (Serial.available() == 0);
  eprom_size = Serial.readString().toInt();

  DDRD = B00000010;
  pinMode(8, INPUT);
  pinMode(9, INPUT);
  digitalWrite(rst, LOW);
  digitalWrite(ce, LOW);

  for (i = 0 ; i < eprom_size ; i++)
  {
    eprom_data = PIND;
    bitWrite(eprom_data, 0, digitalRead(8));
    bitWrite(eprom_data, 1, digitalRead(9));
    Serial.write(eprom_data);
    digitalWrite(clk, LOW);
    digitalWrite(clk, HIGH);
  }

  digitalWrite(ce, HIGH);
  digitalWrite(rst, HIGH);
} // read eprom
//=========================================
void check_eprom()
{
  Serial.println("OK");
  while (Serial.available() == 0);
  eprom_size = Serial.readString().toInt();

  DDRD = B00000010;
  pinMode(8, INPUT);
  pinMode(9, INPUT);
  digitalWrite(rst, LOW);
  digitalWrite(ce, LOW);

  for (i = 0 ; i < eprom_size ; i++)
  {
    eprom_data = PIND;
    bitWrite(eprom_data, 0, digitalRead(8));
    bitWrite(eprom_data, 1, digitalRead(9));
    Serial.write(eprom_data);
    digitalWrite(clk, LOW);
    digitalWrite(clk, HIGH);

    if (eprom_data != 0xFF)
    {
      digitalWrite(ce, HIGH);
      digitalWrite(rst, HIGH);
      return;
    }
  }

  digitalWrite(ce, HIGH);
  digitalWrite(rst, HIGH);
} // check eprom
//=========================================
void write_eprom()
{

} // write eprom
I want to add support for as many chips as possible including : 27C64, 27C128, 27C256, 27C512, 27C010, 27C020, 27C040, 27C080
But their pins differ with each other, any idea how to handle it? I think dip switch is the simplest option?
Attachments
Back.jpg
Front.jpg
Read.PNG

lidnariq
Posts: 9659
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Arduino based EPROM Programmer

Post by lidnariq » Wed Aug 26, 2020 11:14 am

FARID wrote:
Wed Aug 26, 2020 9:32 am
I want to add support for as many chips as possible including : 27C64, 27C128, 27C256, 27C512, 27C010, 27C020, 27C040, 27C080
But their pins differ with each other, any idea how to handle it? I think dip switch is the simplest option?
It is about as simple as you can get, but be careful about accidentally destroying parts by exposing the wrong pin to high Vpp. You definitely want your Vpp supply to be current-limited, and may also want it toggle-able by the arduino.

User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: Arduino based EPROM Programmer

Post by FARID » Fri Aug 28, 2020 8:32 pm

I added a 12 position dip switch to handle pinout difference between EPROMs, seems good and working, but what is the modern method?

C# Code :

Code: Select all

using System;
using System.Drawing;
using System.IO;
using System.IO.Ports;
using System.Threading;
using System.Windows.Forms;

namespace EPROM_Programmer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        //////////////////////////////global variables//////////////////////////////            
        SerialPort Serial;
        int i, j;
        int eprom_size;
        byte[] eprom_data;
        byte[] file_data;
        int time;
        string response;

        //////////////////////////////form load//////////////////////////////
        private void Form1_Load(object sender, EventArgs e)
        {
            this.BackColor = Color.FromArgb(224, 224, 208);
            load_picture(@"Dipswitch\Null.png");
            comboBox2.Enabled = false;
            btn_read.Enabled = false;
            btn_compare.Enabled = false;
            btn_check.Enabled = false;
            btn_write.Enabled = false;            
        }

        private void load_picture(string picture_file)
        {
            try
            {
                pic_dipswitch.Image = Image.FromFile(picture_file);
            }
            catch (System.IO.FileNotFoundException)
            {
                MessageBox.Show("Missing a picture file!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }

        //////////////////////////////select eprom//////////////////////////////
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedIndex)
            {
                // 2000Hex = 8KB = 27C64
                case 0:
                    eprom_size = 8192;
                    load_picture(@"Dipswitch\27C64.png");
                    break;       

                // 4000Hex = 16KB = 27C128
                case 1:
                    eprom_size = 16384;
                    load_picture(@"Dipswitch\27C128.png");
                    break;      

                // 8000Hex = 32KB = 27C256
                case 2:
                    eprom_size = 32768;
                    load_picture(@"Dipswitch\27C256.png");
                    break;      

                // 10000Hex = 64KB = 27C512
                case 3:
                    eprom_size = 65536;
                    load_picture(@"Dipswitch\27C512.png");
                    break;      

                // 20000Hex = 128KB = 27C010
                case 4:
                    eprom_size = 131072;
                    load_picture(@"Dipswitch\27C010.png");
                    break;     

                // 40000Hex = 256KB = 27C020
                case 5:
                    eprom_size = 262144;
                    load_picture(@"Dipswitch\27C020.png");
                    break;     

                // 80000Hex = 512KB = 27C040        
                case 6:
                    eprom_size = 524288;
                    load_picture(@"Dipswitch\27C040.png");
                    break;

                // 100000Hex = 1MB = 27C080
                case 7:
                    eprom_size = 1048576;
                    load_picture(@"Dipswitch\27C080.png");
                    break;
            }
            eprom_data = new byte[eprom_size];
            file_data = new byte[eprom_size];
            comboBox2.Enabled = true;
        }

        //////////////////////////////select port//////////////////////////////
        private void comboBox2_DropDown(object sender, EventArgs e)
        {
            comboBox2.Items.Clear();
            string[] ports = SerialPort.GetPortNames();
            comboBox2.Items.AddRange(ports);
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            Serial = new SerialPort(comboBox2.Text, 250000, Parity.None, 8, StopBits.One);

            Serial.ReadBufferSize = 2097152;
            Serial.ReadTimeout = 2000;
            btn_read.Enabled = true;
            btn_compare.Enabled = true;
            btn_check.Enabled = true;
            //btn_write.Enabled = true;            
        }

        //////////////////////////////read eprom//////////////////////////////
        private void btn_read_Click(object sender, EventArgs e)
        {
            try
            {
                Serial.Open();
            }
            catch
            {
                MessageBox.Show("Could not open the COM port!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Thread.Sleep(1000);
            Serial.Write("<READ>");

            try
            {
                response = Serial.ReadLine();
            }
            catch (TimeoutException)
            {
                MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Serial.Close();
                return;
            }

            if (response != "OK\r")
            {
                MessageBox.Show("Response Error!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                Serial.Write(eprom_size.ToString());

                progressBar1.Maximum = eprom_size;
                time = 0;
                timer1.Start();

                for (i = 0; i < eprom_size; i++)
                {
                    try
                    {
                        eprom_data[i] = (byte)Serial.ReadByte();
                    }
                    catch (TimeoutException)
                    {
                        MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        Serial.Close();
                        timer1.Stop();
                        return;
                    }
                    progressBar1.Value = i;
                    Application.DoEvents();
                }

                String filename = DateTime.Now.ToString("yyyy-MM-dd HH-mm ") + comboBox1.SelectedItem.ToString() + ".bin";

                using (BinaryWriter writer = new BinaryWriter(File.Open(filename, FileMode.Create)))
                    writer.Write(eprom_data);

                Serial.Close();
                timer1.Stop();

                MessageBox.Show("Reading EPROM was successful!", "Read EPROM", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        } // read eprom

        //////////////////////////////compare eprom//////////////////////////////
        private void btn_compare_Click(object sender, EventArgs e)
        {
            int mismatch = 0;

            openFileDialog1.Filter = "Binary files |*.bin";
            openFileDialog1.FileName = "ROM.bin";
            openFileDialog1.ShowDialog();

            try
            {
                file_data = System.IO.File.ReadAllBytes(openFileDialog1.FileName);
            }
            catch (System.IO.FileNotFoundException)
            {
                MessageBox.Show("Could not open the file!\nPlease select a binary file to comapre with EPROM.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            try
            {
                Serial.Open();
            }
            catch
            {
                MessageBox.Show("Could not open the COM port!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Thread.Sleep(1000);
            Serial.Write("<COMPARE>");

            try
            {
                response = Serial.ReadLine();
            }
            catch (TimeoutException)
            {
                MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Serial.Close();
                return;
            }

            if (response != "OK\r")
            {
                MessageBox.Show("Response Error!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                Serial.Write(eprom_size.ToString());

                progressBar1.Maximum = eprom_size;
                time = 0;
                timer1.Start();

                for (i = 0; i < eprom_size; i++)
                {
                    try
                    {
                        eprom_data[i] = (byte)Serial.ReadByte();
                    }
                    catch (TimeoutException)
                    {
                        MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        Serial.Close();
                        timer1.Stop();
                        return;
                    }

                    progressBar1.Value = i;
                    Application.DoEvents();
                }

                Serial.Close();
                timer1.Stop();

                for (i = 0; i < eprom_size; i++)
                {
                    if (eprom_data[i] != file_data[i])
                        mismatch++;
                }

                if (mismatch == 0)
                {
                    MessageBox.Show("The file and EPROM are identical!", "Compare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(mismatch.ToString() + " mismatch found!", "Compare", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        } // compare eprom

        //////////////////////////////blank check//////////////////////////////
        private void btn_check_Click(object sender, EventArgs e)
        {
            try
            {
                Serial.Open();
            }
            catch
            {
                MessageBox.Show("Could not open the COM port!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Thread.Sleep(1000);
            Serial.Write("<CHECK>");

            try
            {
                response = Serial.ReadLine();
            }
            catch (TimeoutException)
            {
                MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Serial.Close();
                return;
            }

            if (response != "OK\r")
            {
                MessageBox.Show("Response Error!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                Serial.Write(eprom_size.ToString());

                progressBar1.Maximum = eprom_size;
                time = 0;
                timer1.Start();

                for (i = 0; i < eprom_size; i++)
                {
                    try
                    {
                        eprom_data[i] = (byte)Serial.ReadByte();
                    }
                    catch (TimeoutException)
                    {
                        MessageBox.Show("No response from the programmer!\nCheck the connections and select the correct COM port.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        Serial.Close();
                        timer1.Stop();
                        return;
                    }

                    if (eprom_data[i] != 0xFF)
                    {
                        Serial.Close();
                        timer1.Stop();
                        MessageBox.Show("The EPROM is NOT blank!", "Balnk Check", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    progressBar1.Value = i;
                    Application.DoEvents();
                }

                Serial.Close();
                timer1.Stop();

                MessageBox.Show("The EPROM IS blank!", "Balnk Check", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        } // blank check

        //////////////////////////////write eprom////////////////////////////// 
        private void btn_write_Click(object sender, EventArgs e)
        {

        } // write eprom

        //////////////////////////////timer//////////////////////////////
        private void timer1_Tick(object sender, EventArgs e)
        {
            label3.Text = string.Format("Elapsed time : {0:00}:{1:00}", time / 60, time % 60);
            time++;
        }
    }
}
Arduino Code :

Code: Select all

#define rst 12
#define clk 13

unsigned long i;
unsigned long eprom_size;
byte eprom_data;
String command;
//=========================================
void setup()
{
  Serial.begin(250000);

  // address lines ==> 0
  pinMode(rst, OUTPUT);
  digitalWrite(rst, HIGH);

  // clock ready
  pinMode(clk, OUTPUT);
  digitalWrite(clk, HIGH);
} // setup
//=========================================
void loop()
{
  command = Serial.readString();

  if (command == "<READ>")
    read_eprom();
  
  if (command == "<COMPARE>")
    read_eprom();

  if (command == "<CHECK>")
    check_eprom();
} // loop
//=========================================
void read_eprom()
{
  Serial.println("OK");
  while (Serial.available() == 0);
  eprom_size = Serial.readString().toInt();

  DDRD = B00000010;
  pinMode(8, INPUT);
  pinMode(9, INPUT);
  digitalWrite(rst, LOW);

  for (i = 0 ; i < eprom_size ; i++)
  {
    eprom_data = PIND;
    bitWrite(eprom_data, 0, digitalRead(8));
    bitWrite(eprom_data, 1, digitalRead(9));
    Serial.write(eprom_data);
    digitalWrite(clk, LOW);
    digitalWrite(clk, HIGH);
  }

  digitalWrite(rst, HIGH);
} // read eprom
//=========================================
void check_eprom()
{
  Serial.println("OK");
  while (Serial.available() == 0);
  eprom_size = Serial.readString().toInt();

  DDRD = B00000010;
  pinMode(8, INPUT);
  pinMode(9, INPUT);
  digitalWrite(rst, LOW);

  for (i = 0 ; i < eprom_size ; i++)
  {
    eprom_data = PIND;
    bitWrite(eprom_data, 0, digitalRead(8));
    bitWrite(eprom_data, 1, digitalRead(9));
    Serial.write(eprom_data);
    digitalWrite(clk, LOW);
    digitalWrite(clk, HIGH);

    if (eprom_data != 0xFF)
    {
      digitalWrite(rst, HIGH);
      return;
    }
  }

  digitalWrite(rst, HIGH);
} // check eprom

Attachments
EPROM Programmer [2020-08-28].zip
(658.57 KiB) Downloaded 14 times
Pinout_difference.PNG
Read_27C080.PNG
Read_Schematic.png

lidnariq
Posts: 9659
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Arduino based EPROM Programmer

Post by lidnariq » Fri Aug 28, 2020 8:49 pm

"Modern" programmers allow each pin to be driven at V1, V2, ground, or high-impedance (for reading/verification). Additionally, both voltages are also often tunable, allowing for programming anything from modern 1.8V NAND flash to older UVEPROMs. You may be able to find a leaked copy of the schematic for the TL866, which uses a PIC with integrated USB and a bunch of pin drivers and latches.

Only the very oldest EPROMs need three or more voltages (such as the NTE2708, which requires four: 5V, -5V, +12V, and 26V)

User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: Arduino based EPROM Programmer

Post by FARID » Fri Sep 11, 2020 4:02 am

Due to limitation of space on arduino uno shield I had to remove DIP switch.
By using four 3 pin jumpers it is possible to handle pinout difference between EPROMs.
So the current hardware supports 27C010, 27C020, 27C040, 27C080.
Any idea before ordering the PCB? Does it look fine?
Attachments
Schematic.png
3D.png
Overlay.png
Top.png
Bottom.png

lidnariq
Posts: 9659
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Arduino based EPROM Programmer

Post by lidnariq » Fri Sep 11, 2020 10:39 am

FARID wrote:
Fri Sep 11, 2020 4:02 am
Any idea before ordering the PCB? Does it look fine?
Only two thoughts are:
1- How are you making the PCB? In general, it'd be better to add a ground plane (ground pour) - it usually improves electrical robustness. If you're etching it by yourself using ferric chloride, the less copper you remove the longer your solution will last. If you're using a PCB mill, using voronoi isolation routing will reduce the total amount of milling time.
2- Is the thing that you've called a "ZIF" socket actually going to have one? Those are wider than the amount of room you've left for the jumpers and maybe the ICs.

Post Reply