EEPROM PROGRAMMER USING BINARY FILE FROM COMPUTER

Hello, I tried researching this for hours before posting, and this is my last ditch effort to hopefully find a solution to save my project. I know there are plenty of helpful people far more experienced than I am and I hope they can point me in the right direction.

My goal is to use an Arduino Nano (specifically a Keyestudio clone) to be able to read and write to a 28C256 EEPROM. The external hardware that will allow me to do this is two HC595 shift registers which will control the address pins.
I have made an EEPROM Programmer before, following along with Ben Eaters amazing electronics videos, however this was for more structured data, and now I am trying to take a binary file and write each byte in order to the EEPROM. The main problem I am running into is the limitations the Arduino Library supports. Normally I could just use a library like:

#include <iostream>
#include <fstream>

However, these libraries are not supported from what it seems and I cannot figure out a way to get the functionality of a stream into my code. I have so far a write and read command which can display information to the serial monitor, and I understand Arduino has Streams available using SD cards, Wire, Ethernet, and Serial, however, my NANO does not support ethernet or SD cards and the Wire and Serial Streams seems to only interface with two pins each (RX D0 and TX D1 for Serial; A4 SDA and A5 SCL for Wire). I want to be able to take a stream which affects all of the pins the nano has to offer so I can set the address, set the data and then pulse the write enable.

I have basically all the code and hardware set up, but I got to this last piece and it is just tearing me apart. I feel like there should be a way to achieve what I am trying to do, but I can’t seem to find it. I was looking into the SerialEvent() method, but this seems to only update when new data is coming into the arduino from the Hardware Pin RX. This will not produce what I want. I need to control it from the computer, not an external source.

I feel confident in my coding and hardware abilities if the right tools are presented to me, but all I am getting so far is that the Serial Stream and Wire Streams let me read or write from two pins each, not even including the fact that they don’t take file input which is highly desired for robust function.

Again, the desired outcome is to read a raw binary file with the data I wish to print onto the EEPROM. I cannot find support for this kind of functionality, and I would even settle for copying the data into a string for parsing, but this requires

#include <stringstream>

which again is not supported to my knowledge unless there is an amazing work around. I heard about the STL port to Arduino, but I do not know if it is worth going down that rabbit hole, could my solution be there? Will check back in the morning, its 2:00 am where I am right now, Good Night and Thank You dearly for any help! Sincerely, Jace Cockayne

Send the file over USB (COMx:) byte by byte, eventually wait for an ACK from the Arduino when the next byte or page can be programmed.

If you don't want to program the entire chip then invent some protocol that tells the Arduino the next starting address and number of bytes to follow.

Again, the desired outcome is to read a raw binary file with the data I wish to print onto the EEPROM

Is this a basic representation of your project?
Binary file source ----????------> Arduino -------> EEPROM

And you are saying the ???? could be anything, like a COM/Serial, parallel, I2C, SPI, etc?

hzrnbgy:
Is this a basic representation of your project?
Binary file source ----???------> Arduino -------> EEPROM

And you are saying the ??? could be anything, like a COM/Serial, parallel, I2C, SPI, etc?

I would be fine with any connection that got the desired result. I forgot to specify that the EEPROM has a parallel interface, so all address and data lines must be set and held before pulsing the write enable. Whatever the ??? is, it would connect the computer to the arduino. I didn’t know there were any other methods besides those I listed (Serial, SD, Wire, Ethernet). Of those I listed, I know only Serial or Wire applies to my arduino Uno.

You’re up a tree looking for wood. Stop already.

UNO does not support ethernet or SD cards

Uh, no. A thousand times no. Any search engine will return thousands of hits when presented with “Arduino Uno sd card”. That said, It does require a $1 piece of hardware, a card receptacle with the required level translators and 3.3 volt regulator required by the sd card.

It’s called the SD library. https://www.arduino.cc/en/reference/SD

Serial is the easiest and most popular since you already have the hardware for that (USB-to-serial chip) built in the Arduino. You can do WiFi but that is more complex, same can be said for SD card. Are you just looking for options or are you actually trying to solve your problem with whatever solution that can be done in a reasonable time? Because if that is the case, serial is the easiest and can be done relatively fast.

DrDiettrich:
Send the file over USB (COMx:) byte by byte, eventually wait for an ACK from the Arduino when the next byte or page can be programmed.

If you don't want to program the entire chip then invent some protocol that tells the Arduino the next starting address and number of bytes to follow.

This sounds like what I am trying to do, but my problem is that I don't know how the arduino program will access the data to be sent byte by byte when it is on my computer and arduino does not seem to support iostreams outside of the builtins (Serial, Wire, Ethernet, SD). Also, last night I forgot to say that the EEPROM has a parallel interface; all data and address lines must be set before pulsing the Write Enable.

WattsThat:
You’re up a tree looking for wood. Stop already.

Uh, no. A thousand times no. Any search engine will return thousands of hits when presented with “Arduino Uno sd card”. That said, It does require a $1 piece of hardware, a card receptacle with the required level translators and 3.3 volt regulator required by the sd card.

It’s called the SD library. Arduino - SD

Apologies, I mistakenly refereed to my NANO as an UNO. I said NANO at first, but later said UNO. I fixed this mistake now. Also, I am looking to do something with the hardware I already have, not buy new stuff.

hzrnbgy:
Serial is the easiest and most popular since you already have the hardware for that (USB-to-serial chip) built in the Arduino. You can do WiFi but that is more complex, same can be said for SD card. Are you just looking for options or are you actually trying to solve your problem with whatever solution that can be done in a reasonable time? Because if that is the case, serial is the easiest and can be done relatively fast.

Yes I am looking at Serial, but I am trying to figure out how the arduino program accesses the file on my computer, and then once it is accessed, how the arduino will use the data when it seems that it only affects the two serial lines TX and RX

The Arduino does not "access" the file on your PC. A program on your PC must send the file, byte by byte, to your Arduino. And while you are still in the design stage, how will you tell the Arduino that the last byte of the file has been sent, and don't expect any more?

Paul

jacencockayne:
Apologies, I mistakenly refereed to my NANO as an UNO. I said NANO at first, but later said UNO. I fixed this mistake now. Also, I am looking to do something with the hardware I already have, not buy new stuff. Yes I am looking at Serial, but I am trying to figure out how the arduino program accesses the file on my computer, and then once it is accessed, how the arduino will use the data when it seems that it only affects the two serial lines TX and RX

I think you have a problem with the fundamentals of serial communications.

The binary file resides on your PC. A program on your PC will open a COM port and will send the data serially to the Arduino. As mentioned above, because the programming of bytes takes time, this program will send the data in packets of, say, 64 bytes and will wait for a message back from the Arduino when it's ready to accept more.

On the Arduino side, you'll receive 64 bytes. You will take each byte in the 64-byte receive buffer and program them to the EEPROM. When the programming of all 64 bytes is complete, you'll send an acknowledge message back to the PC indicating you're reading for more.

The program running on the PC could begin the sequence by sending a message telling the Arduino where it wants the programming to begin (the address in the EEPROM) and how many bytes are to be programmed. Or you could just assume that out of reset you'll be programming all 32Kbytes starting from address 0x0000.

You could do this messaging over the same serial connection with which you connect your Nano to the PC and program it from the IDE, in the same way that the serial monitor can be used to send and receive data to/from the Arduino when it's running.

Install an sd card into a usb adapter. Plug into pc. Copy the binary file to the sd card. Remove from adapter, plug into Arduino interface board, read file from sd and write to memory device.

Read from the memory device, write it to the sd card. Remove card from the Arduino, install in USB adapter, copy file to pc.

If you want to ignore the simplicity of using an sd card, you’re stuck writing code on both the pc and Arduino to transfer the binary file, byte by byte, using a serial link to get data to and from the Arduino to and from the pc.

A side discussion is how many times to you need to program this 28c256? As it stands, this post is showing all the signs of the classic x-y problem as we don’t know anything at all about what the the final project is, we’re just discussing how to get a data stream into a chip.