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