Another attempt for I2C eeprom, this time - 25C256.


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1,078

    Default Another attempt for I2C eeprom, this time - 25C256.

    Hello.
    I decided to give it another try, now with this module.

    https://www.elecrow.com/i2c-eeprom-m...256-p-736.html

    Pull up resistors installed, and following code configured.
    when properly working, it should produce chirp up, chirp down sound. But it does not
    of course, chirp up - write, works fine, because here it chirps directly, but in read routine
    I'm getting zeros.

    Only what I've found out, that if I set read address to 160 (A0) it returns 255, for any other address, it returns 0.
    So somehow, chip responds, right? but not completely.
    What I'm missing?

    Code:
    
    x var byte
    y var byte
    z var byte
    sda var portb.1
    scl var portb.0
    
    
    ehmo:
    for X=0 to 12 
    I2CWrite sda, scl, 160, x, [x]
    hpwm 1,127,1000+x*10
    pause 1
    next
    hpwm 1,0,1000 'mute
    pause 500
    
    
    for x=12 to 0 step -1
    i2cread sda, scl, 160,x,[y]
    hpwm 1,127,1000+Y*10
    pause 1
    next
    hpwm 1,0,1000
    pause 500
    goto ehmo

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    For read try 161 address

  3. #3
    Join Date
    Feb 2013
    Posts
    1,078


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    No difference - already tried all combos like 159+160, 160+161 and so on....

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    The 25C265 as mentioned in the title is a SPI EEPROM. That won't ever work with the I2C command.
    If, on the other hand, it's the 24C256 then the state of the A0-A2 pins will have an effect on the address. Anyway, looking at the 24C256 datasheet:
    In Byte Write mode the Master sends a START, followed
    by Slave address, two byte address and data to be written
    (Figure 6).
    And then your code:
    Code:
    I2CWrite sda, scl, 160, x, [x]
    You're using the x-variable as the address (and data) but have it defined as a byte.

    With that said, I have not ever used I2C so I'm certainly no expert.

  5. #5
    Join Date
    Feb 2013
    Posts
    1,078


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    Yes I made an error in tittle, chip is certainly 24C256.

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    you need to do it properly

    Name:  c1.jpg
Views: 587
Size:  30.4 KB
    Last edited by richard; - 14th January 2022 at 23:21. Reason: can;t type
    Warning I'm not a teacher

  7. #7
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    C1, if you have the spare cash, I would recommend a cheap logic analyzer. Saelig sells one for (I think I paid) around $80 US. I haven't used mine in several years, as I now have a Pico Scope that does much more, and better. I am in the northeast US. If you're willing to cover shipping, you can have my old Saelig. It will help you to verify communication protocols and baud rates for situations like this. If interested, PM me & we can take it from there. You might be able to find one on eBay, Amazon, or Craigslist (or whatever local online sellers site you have) for next to nothing, and with cheaper or even no shipping.

  8. #8
    Join Date
    Feb 2013
    Posts
    1,078


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    So what's wrong with 160? it is chip address, A0, and isn't that fixed?

    Regarding the logic analyzer. I have that saelae thing.
    I can't get it work as I understand it should work - run continuously, monitor bytes, like scope does. it only has "run", it runs, fills up buffer in couple of seconds and stops - that's all. For that purposes, I bought a scope with built-in logic analyzer, which can run infinitely - Hantek DSO2D10 - but was able it to work only very low speeds, for protocol decoding.

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    it a constant , pbp constants are 16 bits , i2c address are 8 bit
    use your logic analyzer
    Warning I'm not a teacher

  10. #10
    Join Date
    Feb 2013
    Posts
    1,078


    Did you find this post helpful? Yes | No

    Default Re: Another attempt for I2C eeprom, this time - 25C256.

    So what should I write instead of 160?

    I've searched this forum, and people do use plain numbers in I2C eeprom write/read?

Similar Threads

  1. i2c non-eeprom examples?
    By justDIY in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 22nd January 2010, 19:07
  2. Using eeprom for the first time- Help please
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th October 2009, 04:16
  3. Help with i2C eeprom
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 17th March 2006, 01:33
  4. Real Time Clock & Eeprom
    By smart_storm in forum General
    Replies: 8
    Last Post: - 17th February 2006, 20:03
  5. I2C EEPROM Programming
    By Rob in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd March 2005, 16:03

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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