Shop OBEX P1 Docs P2 Docs Learn Events
Read and Write 512K EEPROM — Parallax Forums

Read and Write 512K EEPROM

dondedonde Posts: 51
edited 2012-09-15 22:20 in Propeller 1
I have a Propeller board called Propmodule. The built in EEPROM is 512K. As normal, the first 32k is used for programs. I want to move data data of my program to the unused portion of the EEPROM, for the top 32K is just about full.
How would I do this?

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-15 07:20
    Do you mean you have a 24LC512 which is a 512k BIT memory (so it's actually 64k BYTES)?
  • dondedonde Posts: 51
    edited 2012-09-15 08:34
    Yes, I just copied the description from the vender, which said 512 Kb, which is probably kilobits, not kilobytes, so it would be a 64KB unit.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-09-15 08:40
    There's a link in the PEK sticky thread titled "EEPROM Logging" or something like that. It shows how to read and write to EEPROM.

    Mike Green's "Simple I2C" (or something like that) (in the OBEX) is also a good way (probably better) to read and write to EEPROM.
  • JonnyMacJonnyMac Posts: 9,108
    edited 2012-09-15 08:41
    If you're hoping to move DAT blocks to the upper 32K that will not work; the Propeller Tool (and others) only write a 32K image. What you can do, however, is manually write data from within your code to addresses $8000 and higher. You'll find I2C objects in ObEx that will give you the tools to do this,
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-15 08:41
    donde wrote: »
    Yes, I just copied the description from the vender, which said 512 Kb, which is probably kilobits, not kilobytes, so it would be a 64KB unit.
    It best to not mix terminology especially in the same line because it's confusing saying 512K and 32K without any clarification.
    Anyway, moving data is simple enough but for it to work the way you want is very application specific and we have no idea of your application. Like any requests you need to be specific and when the request is for something very technical then you have to be very technical and supply the information such as your code etc.
  • dondedonde Posts: 51
    edited 2012-09-15 10:50
    JonnyMac wrote: »
    If you're hoping to move DAT blocks to the upper 32K that will not work

    No, I did not want to fiddle with the upper 32K, just the lower 32, which are available.
  • dondedonde Posts: 51
    edited 2012-09-15 11:02
    It best to not mix terminology especially in the same line because it's confusing saying 512K and 32K without any clarification.
    Anyway, moving data is simple enough but for it to work the way you want is very application specific and we have no idea of your application. Like any requests you need to be specific and when the request is for something very technical then you have to be very technical and supply the information such as your code etc.

    Well, I'm very sorry for the confusion. I have now clarified the size. It's a 64 kilo-byte EEPROM. Data consists of bytes, strings and words. I want to move the data from the upper 32K to the lower 32K. I want to read the data for the main program in the upper 32K. I'm talking about maybe 5K. I still don't know the best way.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-09-15 11:02
    You can use any of the I2C drivers in the ObEx to do this. You must keep in mind that the Propeller Tool, when it downloads a program to EEPROM, writes the whole 32K, thus overwriting anything you've put there. If you use "Simple_I2C_Driver", the comments at the beginning and with each method describe how the routines are used. The EEPROM is 64K bytes with addresses running from $0000 to $FFFF. There are routines in "Simple_I2C_Driver" to read and write blocks of data of a specified size into a buffer that you supply. Remember that you have to wait a little while after each write to allow the EEPROM to finish its work. The comments show one way of doing that or you can just wait about 5ms after each write operation.
  • dondedonde Posts: 51
    edited 2012-09-15 11:21
    Mike Green wrote: »
    The comments show one way of doing that or you can just wait about 5ms after each write operation.

    I have downloaded the I2C_ROMDemo_1 and tried it. I see the menu. But ran out of time to continue. I guess I would write a byte, the letter "a" this way?
    setb 33000 a
  • Mike GreenMike Green Posts: 23,101
    edited 2012-09-15 13:34
    I don't know where you got I2C_ROMDemo_1. Have you looked at "Simple_I2C_Driver"?
  • dondedonde Posts: 51
    edited 2012-09-15 16:11
    No, I'm looking at Generic I2C EEPROM Driver in OBEX. I don't see the one you are referring to.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-15 19:05
    Mike Green wrote: »
    I don't know where you got I2C_ROMDemo_1. Have you looked at "Simple_I2C_Driver"?
    Mike, I think we need some volunteers to maintain the OBEX and organize it better, it's a mess trying to find stuff in there.
  • SRLMSRLM Posts: 5,045
    edited 2012-09-15 19:15
    Mike, I think we need some volunteers to maintain the OBEX and organize it better, it's a mess trying to find stuff in there.

    How about a new Obex design that addresses many of the issues of the old?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-15 19:38
    SRLM wrote: »
    How about a new Obex design that addresses many of the issues of the old?
    Any proposals? I think it almost needs a special app just to handle the search parameters and to be able to come up with a short list and ranking etc. Whenever I look at the OBEX and try to find something it's like wading through a junk yard or rummaging through a capacious junk box, you come across lots of interesting stuff but rarely find what you are looking for.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-09-15 19:41
    Here's the link to "Basic I2C Driver". It's listed under that name, either under the "Tools" section or "All".
  • dondedonde Posts: 51
    edited 2012-09-15 22:10
    Mike Green wrote: »
    Here's the link to "Basic I2C Driver". It's listed under that name, either under the "Tools" section or "All".

    OK I found it! Now to try to figure it out. I discovered I have a Schmart kit board I built. It has a 64 KB EEPROM. So, I'll play with it just to learn.

    I think each object should have another readme called README_TOO. This would explain more what the object does, with an example.
    Thanks Mike et all, for your help. I hope I haven't been a pain. I guess this thread is SOLVED. Don't know how to change it.
    donde
  • Mike GreenMike Green Posts: 23,101
    edited 2012-09-15 22:20
    The ReadPage and WritePage routines will read and write large blocks of data to/from a buffer (array variable). You can use a smaller buffer than 5K if you want to increment the EEPROM address for each smaller block that you copy. These routines break up the reading and writing anyway into blocks that don't span an EEPROM page (128 or 256 bytes) since that's what the EEPROMs require. Remember to put in the 5ms delay or the WriteWait loop as shown near line 67.

    One of the conventions for documentation is that the source code contains comments explaining how to use the object. That's what was used here rather than a ReadMe file. This object has been around for some time and has not been updated for a couple of years.
Sign In or Register to comment.