Shop OBEX P1 Docs P2 Docs Learn Events
Need to write HEX file to EEPROM — Parallax Forums

Need to write HEX file to EEPROM

GICU812GICU812 Posts: 289
edited 2008-09-15 06:36 in BASIC Stamp
I need to program an EEPROM, all I have on hand is a stamp, unless someone can tell me how to build a simple circuit to program it directly from PC.

Now I can write data to a specific address manually from the stamp debug, I know enough to do that, but with 16000 locations, that could be tedious.

Heres a short sample of my file

:100000002649C3002A2600002664C5002A240000D1
:10001000266CC5002668C5002633C3002670C500BF
:100020002623002927C3FD13B60013005D1301C466
:100030001304381305002A001300591301C51304D3
:10004000461305002A001300431301C5130454137B

:10000000 - is the address

26 49 C3 00 2A 26 00 00 26 64 C5 00 2A 24 00 00 - is the first 16 bytes of information

D1 - I think is a checksum.

So I need to strip the address and checksum and write the data to EEPROM. I could probably parse the data myself and ditch the address and checksum before I send it to the stamp if needed. So the file would just be 16000 sequential Hex values.

I would think there was an easy way of doing this, I just dont know what it is. Any suggestions?



Im also open to just building a simple programmer if someone knows of software that will do this for me.



Thanks



·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-15 02:31
    There are examples in the Nuts and Volts Columns (number 115 comes to mind) of I2C interfacing with a Stamp. Get the datasheet for the EEPROM you need to program and that will show you the format for the information you need to send to it (address and data) for each location or group of locations (called a page) to be programmed. The Nuts and Volts Column may have an example of writing data to a location for some EEPROM. It may be usable for your EEPROM directly or with minor changes. It should be easy to write a program in PBasic to read one line of this file including the address, then write the 16 bytes to the EEPROM in one block (page). By using the handshaking lines (read SERIN statement chapter in the manual), the Stamp can make the PC pause until it's ready for the next line.

    Be sure to download the sample programs for the column.

    Post Edited (Mike Green) : 9/15/2008 2:36:46 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-15 02:42
    I reread your 1st message. It sounds like you have one of the BS2p/pe/px Stamps since those have built-in I2C statements.

    You can read in one of these lines with a single SERIN like

    SERIN ioPin,Baud,[noparse][[/noparse]WAIT(":"),hex2 ignore,hex4 addr,hex2 ignore,hex2 d(0),hex2 d(1),hex2 d(2),hex2 d(3),hex2 d(4),...,hex2 d(15)]

    All 16 items need to be on one long line. "ignore" is a byte that is ignored. "addr" is the address to be written. "d" is a 16 byte array
    of values to be written to the EEPROM. The checksum is ignored and provides a little padding for the PC to react to the handshaking
    lines (not shown here ... again ... read the SERIN chapter in the manual).
  • GICU812GICU812 Posts: 289
    edited 2008-09-15 02:43
    Ive got enough of a grasp to crudely get data to and from the EEPROM, I just dont know how to move large amounts of data, say like from a text file.



    Ive written an eraser, I can set the EEPROM to all 255, or whatever I want, one byte at a time. Thats a start, but I dont know if there is a way to access a file, or I could even paste one line at a time into the debug window. Mike, im reading your last message, it might be what·I need.

    Post Edited (GICU812) : 9/15/2008 2:50:14 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-15 03:01
    You move large amounts of data one line at a time. Read the SERIN chapter, then make a very short test program to read one line at a time from the PC (with handshaking control). Put a long pause in there to make the PC stop at each line. You'll need some kind of terminal emulator that supports handshaking. It would help to slow down the PC. Some terminal emulators have options to put a pause after each transmitted character or after each line. If that provision is there, use it. Put in a 100ms or 250ms pause after each line and/or a 50ms or 100ms pause after each character, particularly while you're trying out things. If you can put in these pauses, you may not even need the handshaking. Even if it takes a couple of seconds for each line to be processed, you can let it run and go out for a cup of coffee.
  • GICU812GICU812 Posts: 289
    edited 2008-09-15 03:23
    Sounds about right. I've got the program working, it takes one line at a time from the debug window, I'll change the input as needed. I wish you could paste to the debug window. The first program I want to transfer to prove this will work isnt but 20 lines long or so.

    So for now Im off to look for terminal emulator that will work
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-09-15 03:36
    Hi, I have a program that uses a BS2px to write a PC txt file to an EEPROM plugged into a socket on a development board. It also reads the contents if required and writes the results to a text file on a PC, if it's likely to be of use I will try and dig it up.

    Jeff T.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-09-15 04:14
    Jeff -

    You may be one step ahead of yourself. There are HEX text editors (HexEdit comes to mind). Write the data on the PC, file it, and then transmit it serially to a Stamp bytewise so that it may then write it to your EEPROM.

    Just out of curiosity, are you trying to reverse engineer something? If so, there may be other methods less prone to possible typographical or transcription errors.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Involvement and committment can be best understood by looking at a plate of ham and eggs. The chicken was involved, but the pig was committed. ANON
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-09-15 05:26
    Hi Bruce, what I have was specifically designed for the Stamp and designed to be as simple as typing text into Windows Notepad and pressing a button.

    I am not reverse engineering anything,·it evolved from tests that involved reading tokenized code from an EEPROM and using the code to program a remote BS2·hard wired or wireless using the same checksum routines that the Stamp IDE uses.

    This may not be the requirement of GICU812 but the program could achieve his goal, or maybe not.·The offer was intended as an alternative to consider. My problem right now is retrieving the programs from the hard drive in a dead PC, but that is not too big a deal.

    Thanks for showing interest Bruce I hope my explanation was clear.

    Jeff T.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-09-15 05:55
    Jeff -

    The Stache Programmer may or may not hold some general interest for you:
    http://www.emesystems.com/products.htm#Stache

    Regards,

    Bruce Battes

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Involvement and committment can be best understood by looking at a plate of ham and eggs. The chicken was involved, but the pig was committed. ANON
  • GICU812GICU812 Posts: 289
    edited 2008-09-15 06:36
    Im having issues with the in board programmer on a device, and wanted to just tap the lines on the EEPROM and program it with the device off.
Sign In or Register to comment.