+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 21 to 34 of 34

Thread: How to write to upper 32K of a AT24C512 eeprom??

  1. #21

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    Randy,

    Sorry but I use the object Propeller Eeprom (I think that's what it's called) when I store stuff to EEPROM. The Propeller Education Kit sticky on the main Propeller forum page has a link to an EEPROM data logging lab. That's the code I used when I was first learning to use the Propeller. It worked so I haven't bothered to learn how to write to the EEPROM a different way.

    The line of code I wrote in post #3 will write a word to EEPROM.

    The @myWord part assumes you have a word variable declared named "myWord". The eepromAddress would be a value such as $8100.

  2. #22

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    Quote Originally Posted by Duane Degn View Post
    Randy,

    Sorry but I use the object Propeller Eeprom (I think that's what it's called) when I store stuff to EEPROM. The Propeller Education Kit sticky on the main Propeller forum page has a link to an EEPROM data logging lab. That's the code I used when I was first learning to use the Propeller. It worked so I haven't bothered to learn how to write to the EEPROM a different way.

    The line of code I wrote in post #3 will write a word to EEPROM.

    The @myWord part assumes you have a word variable declared named "myWord". The eepromAddress would be a value such as $8100.
    I actually use that object for some of my data saves. But I have not got it to work to save to specific addresses in the upper 32K of the 64K eeprom.
    Works good for saving named varibles.
    Randy Westmoreland
    www.sherwoodperformance.com

  3. #23

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    The 65535 suggests that ReadWord is returning a -1 which indicates that it can't read the EEPROM. Are you sure you have an AT24C512 EEPROM or another type of 64K EEPROM? How about trying an address in the first 32K like $7FFE? That's not likely to be used by anything although it will get cleared when you download a new program to the EEPROM. What kind of board are you using?

  4. #24

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    Randy,

    The attached program will tell you if your EEPROM is 32K or 64K.

    When I run the program on my Demo board(which has 32K EEPROM) I get this.

    Code:
      fileName = dwd_AssignId
     This program allows one to write an ID number to EEPROM
     Making sure EEPROM is at least 64K.
     Reading from EEPROM address $7FFF
     lastLowByte = $00
     Reading from EEPROM address $FFFF
     lastHighByte = $00
     Writing 1 to EEPROM address $FFFF
     Reading from EEPROM address $7FFF
     lastLowByte = $01
     This EEPROM is only 32K.
     You will not be able to store data in
     the upper section of EEPROM.
     Restoring original EEPROM value.
     **** End of Program ****
    When I run it on a board with 64K or EEPROM I get this output.

    Code:
      fileName = dwd_AssignId
     This program allows one to write an ID number to EEPROM
     Making sure EEPROM is at least 64K.
     Reading from EEPROM address $7FFF
     lastLowByte = $00
     Reading from EEPROM address $FFFF
     lastHighByte = $FF
     Reading 16 bytes from EEPROM address $FFF0
     EEPROM $FFF0: $FF $FF $FF $FF $FF $FF $FF $FF $FF $FF $FF $FF $00 $FF $FF $FF
     These are the EEPROM options:
     Enter a single character to select menu option.
     x) Exit Program
     g) assign global ID (each Propeller should be different)
     s) assign system ID
     r) read a section of EEPROM
     f) fill each byte in a section of EEPROM with a single value
     l) change arbitrary address location
    The program uses a baud of 57,600. It gives you three seconds to open a terminal window before it starts sending information to the terminal window. You can either load into RAM(F10) or EEPROM(F11). (Of course if you load it to RAM, it will only run once.)

    This should let you know if your EEPROM is 32K or 64K.

  5. #25

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    Code:
    OBJ             
    
      LCD       : "Brilldea-LM9033A Driver-Ver002.spin"         
      Gr        : "graphics.spin"                              
      eeprom    : "Propeller Eeprom"
      FD        : "FullDuplexSerialPlus.spin"
      stringObj : "ASCII0_STREngine_1.spin"
      filter    : "filter_ma.spin"
      i2c       : "Basic_I2C_Driver.spin"
    
      '*************************************
    PUB main
      
      dira[tbout]~~
      outa[tbout]~
      save:=0
      'eeprom.VarRestore(@setpoint, @control[1500])           '<<<<<<<<<<<<<<<<THIS IS THE PROBLEM.
      coginit(1,buttons,@stack[0])
      coginit(2,delaytimer,@stack[50])
      coginit(3,curve,@stack[300])
      LCD.start(_LCD_cs, _LCD_rst, _LCD_rs, _LCD_sc, _LCD_sd, _LCD_bl)
      gr.start
      gr.setup(_xtiles, _ytiles, 0, 0, @VIDEOmemory)
      LCD.reset
      LCD.initialize(0, @LCDmemory)

    I found the problem. I'm using the propellor eeprom object and the i2c object in my program. and when this runs "eeprom.VarRestore(@setpoint, @control[1500])" then the i2c stuff does not work. Can I not have 2 different eeprom controlling objects in my program? Any input on why it does not work? When I remove the line "eeprom.VarRestore(@setpoint, @control[1500])" I can read and write with the i2c perfectly.
    Randy Westmoreland
    www.sherwoodperformance.com

  6. #26

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    Can I not have 2 different eeprom controlling objects in my program? Any input on why it does not work?
    Why use two different I2C objects on the same bus? Anyway the I2C drivers can drive the IO pins. One of the drivers might be leaving an IO pin in a state that the other does not like. I'm not sure how Propeller Eeprom works but you have the source so take a look or post all your code.

  7. #27

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    Quote Originally Posted by Mike G View Post
    Why use two different I2C objects on the same bus? Anyway the I2C drivers can drive the IO pins. I'm not sure how Propeller Eeprom works but you have the source so take a look.
    I was using propellor eeprom to backup some of my spin named variables which get reset when power is cycled. And when power is turned back on i use the VarRestore to copy them back into the variables. propellor eeprom is easy to use for this purpose but the Basic_I2C_Driver.spin works better for save data to the upper 32k.
    Randy Westmoreland
    www.sherwoodperformance.com

  8. #28

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    You can't use two objects at the same time to control the same I/O pins unless they're written in such a way as to allow this. Most objects initialize the I/O pins to some particular state and assume that they'll still be in that state the next time the object is called. If another object is called in-between, neither may work properly. This is also true if the two objects are used by two separate cogs. Each cog has its own set of I/O registers (DIRx, OUTx, INx) and they can interact. You can write objects so they "play nice" together, but that can be difficult and complicate things.

    You can also use Basic_I2C_Driver to do the same sort of thing as VarRestore. Just write the data (valueToSave) to the corresponding location for the variable (globalVariable) in EEPROM like:

    I2C.WriteWord( I2C#BootPin, I2C#EEPROM, @globalVariable, valueToSave)
    repeat while I2C.WriteWait( I2C#BootPin, I2C#EEPROM, @globalVariable)

    When the program restarts, globalVariable will be initialized to the value valueToSave. Obviously, use WriteByte or WriteLong if that's appropriate for the variable.

  9. #29

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    once my program uses VarBackup or VarRestore from the propellor eeprom object then none of the Basic_I2C_Driver works. I'm wondering is something in the proprllor eeprom object disables something. I'd like to keep both og them working cause there great for the things I use them for . If not possible I will have to spend alot of time changing my program.
    Randy Westmoreland
    www.sherwoodperformance.com

  10. #30

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    I see what our saying. I guess I'll have to change up my program to use the Basic_I2C_Driver.spin only.
    thanks
    Randy Westmoreland
    www.sherwoodperformance.com

  11. #31

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    You could also try calling I2C.Initialize( I2C#BootPin ) after calling VarBackup or VarRestore and before calling one of the other I2C routines. This will reinitialize the I/O pins and the EEPROM to a known state.

  12. #32

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    Quote Originally Posted by Mike Green View Post
    You could also try calling I2C.Initialize( I2C#BootPin ) after calling VarBackup or VarRestore and before calling one of the other I2C routines. This will reinitialize the I/O pins and the EEPROM to a known state.
    I tried that but once varbackup or varrestore is used the i2c routines stop working. Both routines never run at the same time. the i2c routines do not affect varbackup or varrestore. i2c is the only thing affected. some how varbackup and varrestore are setting something that disables i2c routines
    Randy Westmoreland
    www.sherwoodperformance.com

  13. #33

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    From Post #13
    Quote Originally Posted by Duane Degn View Post
    If you're using other I2C drivers in the the same project you'll want to set all the pins used to inputs and set them to their "low" state so other cogs can use the pins. (I had this problem once when using a different driver to read a real time clock.)
    I've added an "I2cEnd" method to some of my projects.

    Code:
    PUB I2cEnd
      ' Restore pins to original state so other cogs can use them.
      outa[SCL]~                                    
      dira[SCL]~
      outa[SDA]~                                   
      dira[SDA]~
    I've found a lot of I2C drivers don't release the lines (hence my earlier warning).

  14. #34

    Default Re: How to write to upper 32K of a AT24C512 eeprom??

    Quote Originally Posted by Duane Degn View Post
    From Post #13


    I've added an "I2cEnd" method to some of my projects.

    Code:
    PUB I2cEnd
      ' Restore pins to original state so other cogs can use them.
      outa[SCL]~                                    
      dira[SCL]~
      outa[SDA]~                                   
      dira[SDA]~
    I've found a lot of I2C drivers don't release the lines (hence my earlier warning).
    That worked like a champ!!!! Thank all of you for your help. I'm back on track now :-) My program seems to be working great and I get to keep both eeprom programs.
    Randy Westmoreland
    www.sherwoodperformance.com

+ Reply to Thread

Similar Threads

  1. "Propeller Eeprom" works for upper 32kB of 64kB EEPROM chip
    By Rayman in forum Propeller 1 Multicore Microcontroller
    Replies: 5
    Last Post: 12-18-2011, 07:50 PM
  2. Proto Board EEPROM at24c512
    By agfa in forum Propeller 1 Multicore Microcontroller
    Replies: 18
    Last Post: 07-22-2009, 02:01 AM
  3. I2C EEPROM PASM Driver (AT24C512, etc)
    By Cluso99 in forum Propeller 1 Multicore Microcontroller
    Replies: 4
    Last Post: 01-22-2009, 07:51 AM
  4. Unable to write to 64K EEPROM Upper Half
    By william chan in forum Propeller 1 Multicore Microcontroller
    Replies: 5
    Last Post: 03-22-2008, 04:41 PM
  5. Replies: 11
    Last Post: 08-04-2004, 10:24 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts