strange 24lc512 eeprom problem


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2011
    Posts
    21

    Default strange 24lc512 eeprom problem

    Hi all,

    i've very strange problem while writing to external eeprom 24lc512. its connected to 18f4550 with 4.7k pullups. eeprom data is sent through USB from PC

    i am writing eeprom in chunk of 28bytes, writing to first 28 location is ok but when i write to 29th location the 28th location byte gets corrupt. when i try to correct it by writing a single byte at 28th location then the 27th location byte gets corrupt.
    i have no idea why eeprom is not working as expected. below is the code:
    Code:
                  for aa = 3 to 62 step 2
                    temp_add = USBRXBuffer[aa]
                    gosub hexconvert    
                    edata[0] = temp_add * 16
                    
                    temp_add = USBRXBuffer[aa+1]
                    gosub hexconvert
                    edata[1] = temp_add
                    
                    edata[2] = edata[1] + edata[0]
                    prg_block[cc] = edata[2]
                    cc = cc + 1                             
                next aa                 
                I2cwrite SDA,SCL,CONTROL,address[4],[str prg_block\cc]
                pause 10
    eeprom dump, see at last 28th byte should be FF but its D9:
    Code:
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    FF
    D9
    FF
    FF
    FF
    when i specifically try to correct 28th byte then the 27th byte gets corrupted
    can you please help me solving this issue

    Thank You

  2. #2
    Join Date
    Mar 2005
    Location
    Cocoa, Florida
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: strange 24lc512 eeprom problem

    If you're on 3V3 try a smaller value pullup, which wouldn't hurt on 5V.
    Check the leading edge with a scope.
    If you have a lot of capacitance on those tracks pullup should be smaller, as low as 1K5.

    It sounds like a timing issue.
    Have you tried writing in small chunks with a pause in between?

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default Re: strange 24lc512 eeprom problem

    Try writing fixed data to the eeprom first; writing a loop value in binary. That way you will be sure the proper data gets written to the proper address. Using FF isn't giving you a fair test of your logic, something like:

    0000 0001 pos. 1
    0000 0010 2
    0000 0011 3
    0000 0100 4
    0000 0101 5
    0000 0110 6
    0000 0111 7
    0000 1000 8
    0000 1001 9
    0000 1010 10
    0000 1011 11
    0000 1100 12
    0000 1101 13
    0000 1110 14
    0000 1111 15
    0001 0000 16
    0001 0001 17
    0001 0010 18
    0001 0011 19
    0001 0100 20
    0001 0101 21
    0001 0110 22
    0001 0111 23
    0001 1000 24
    0001 1001 25
    0001 1010 26
    0001 1011 27
    0001 1100 28
    0000 0001 pos. 29
    0000 0010 30
    0000 0011 31
    0000 0100 32
    0000 0101 33
    0000 0110 34
    0000 0111 35
    0000 1000 36
    0000 1001 37
    0000 1010 38
    0000 1011 39
    0000 1100 40
    0000 1101 41
    0000 1110 42
    0000 1111 43
    0001 0000 44
    0001 0001 45
    0001 0010 46
    0001 0011 47
    0001 0100 48
    0001 0101 49
    0001 0110 50
    0001 0111 51
    0001 1000 52
    0001 1001 53
    0001 1010 54
    0001 1011 55
    0001 1100 56
    etc

    Robert

  4. #4
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default Re: strange 24lc512 eeprom problem

    Writing to LC eeproms requires 2ms to 5ms delay after each write.

    You are sending a block of bytes at one shot.
    Try sending(writing) them single by single and have 5ms pause after each write.
    Or, you may want to use page write feature for one whole 128-byte page (for LC512) and have one pause after each page.
    check this link :
    http://www.picbasic.co.uk/forum/show...8811&highlight=
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  5. #5
    Join Date
    Jul 2011
    Posts
    21


    Did you find this post helpful? Yes | No

    Default Re: strange 24lc512 eeprom problem

    hi
    thanks all for your reply
    problem solved... i did two things:
    1. started to write 128 locations in one shot instead of 28 as suggested by sayzer
    2. i was using usb port for power supply so i changed it as suggested by kenif
    and then i tested as suggested by demon... issue vanished..
    once again thank you all.

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