Shop OBEX P1 Docs P2 Docs Learn Events
Problem with reading, and writing to EEPROM — Parallax Forums

Problem with reading, and writing to EEPROM

TCTC Posts: 1,019
edited 2014-03-02 13:22 in Propeller 1
Hello all,

I am using JonnyMac's EEPROM driver to try to store and read values from the main EEPROM. I have a 64K EEPROM instead of the normal 32K for the prop.

But I have ran into a little problem that I cant figure out why. Here is what I got,
OBJ

  eeprom        : "jm_24xx512" 

PUB

  eeprom.start(%000)
  eeprom.rd_block($8010, 10, @param)

 **** other stuff ****

When I run this, my program stops. If I comment out
  eeprom.rd_block($8010, 10, @param)
the program works like it should. I cant figure out what is going on, and I was hoping someone could help me figure out what is wrong.

Thanks
TC

Comments

  • kwinnkwinn Posts: 8,697
    edited 2014-03-02 12:26
    Sounds like what you are reading from the eeprom may be over writing your program. Do you have enough space reserved for the data?
  • TCTC Posts: 1,019
    edited 2014-03-02 12:34
    kwinn wrote: »
    Sounds like what you are reading from the eeprom may be over writing your program. Do you have enough space reserved for the data?

    Yes, just as a starter I am only trying to read and write 4 longs starting at address $8010. from my understanding, the prop only uses $0000 to $7FFF for its use. Anything at address $8000 and up the prop does not touch.
  • JonnyMacJonnyMac Posts: 9,107
    edited 2014-03-02 12:38
    Do you have pull-ups on the SDA and SCL lines? I know, a lot of Propeller designs leave the SCL pull-up out and drive that pin, but my I2C driver doesn't -- it expects pull-ups on both (per the I2C spec).

    If your EEPROM is only 32K then you will in fact be reading from address $0010 -- in the program space. Reading from this space isn't harmful; writing to it can be if you don't know what you're doing.
  • TCTC Posts: 1,019
    edited 2014-03-02 12:49
    JonnyMac wrote: »
    Do you have pull-ups on the SDA and SCL lines? I know, a lot of Propeller designs leave the SCL pull-up out and drive that pin, but my I2C driver doesn't -- it expects pull-ups on both (per the I2C spec).

    No, there is no pull up resistor on the SCL line, I followed the schematic in the Propeller datasheet, and the manual. I can add one, have to let iron warm up.
    If your EEPROM is only 32K then you will in fact be reading from address $0010 -- in the program space. Reading from this space isn't harmful; writing to it can be if you don't know what you're doing.

    EEPROM I am using is "24LC512".

    If that was the case, I don't think the program would freeze just trying to read from any location.
  • JonnyMacJonnyMac Posts: 9,107
    edited 2014-03-02 12:57
    No, there is no pull up resistor on the SCL line, I followed the schematic in the Propeller datasheet, and the manual. I can add one, have to let iron warm up.

    Adding the pull-up on SCL will get things going. I've run into this on Propeller boards I didn't build. Again, the I2C spec is open-drain on SDA and SCL and calls for pull-ups on both. My I2C object expects both lines to be pulled-up.

    Mike Green has a nice I2C object that does in fact drive the SCL line high and low.
  • TCTC Posts: 1,019
    edited 2014-03-02 13:22
    JonnyMac wrote: »
    Adding the pull-up on SCL will get things going. I've run into this on Propeller boards I didn't build. Again, the I2C spec is open-drain on SDA and SCL and calls for pull-ups on both. My I2C object expects both lines to be pulled-up.

    That was the ticket, Thanks.
Sign In or Register to comment.