Re: can't write more than one byte to AT24C64 EEPROM using "eeprog"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  expanding on my earlier note since i got a few minutes to test:

On Tue, 25 Jul 2017, rpjday@xxxxxxxxxxxxxx wrote:

>  warning: doing this from memory since someone just walked off with
> my test system, but i'll try to get all the details in:
>
>  in order to read a 4-byte manufacturer string from the EEPROM, i
> used "eeprog", which worked delightfully (displaying for Lenovo):
>
>  # eeprog /dev/i2c-0 0x50 -16 -f -r 0x0060:4
>  LNVO
>
> so reading from the EEPROM using "eeprog" seems to work just fine.
> but when i tried to write a string there:
>
>  # echo -n "rday" | eeprog /dev/i2c-0 0x50 -16 -f -w 0x0060
>
> i got a "i2c_write_3b" error (that's all i can remember of it), and
> when i checked memory, only the first character ("r") had been
> written at address 0x0060, the rest of the characters were
> unchanged.
>
>  as a test, i used "eeprog" to write the remaining characters one at
> a time (at addresses 0x0061, 0x0062 and 0x0063), and that appeared
> to work just fine.
>
>  am i doing something obviously silly? from the man page, it seems i
> should be able to pass a string for writing.

so here's the result of running a few "eeprog" commands. first, read a
4-byte field where the manufacturer code is stored (lines might be
slightly mangled after saving to wordpad):

  # eeprog /dev/i2c-0 0x50 -16 -f -x -r 0x60:4
  eeprog 0.7.5, a 24Cxx EEPROM reader/writer
  Copyright (c) 2003 by Stefano Barbato - All rights reserved.
    Bus: /dev/i2c-0, Address: 0x50, Mode: 16bit
    Reading 4 bytes from 0x60
  .
  0060|  4c 4e 56 4f

if i print that in character, it displays properly as "LNVO" for
lenovo:

  # eeprog /dev/i2c-0 0x50 -16 -f -r 0x60:4
  eeprog 0.7.5, a 24Cxx EEPROM reader/writer
  Copyright (c) 2003 by Stefano Barbato - All rights reserved.
    Bus: /dev/i2c-0, Address: 0x50, Mode: 16bit
    Reading 4 bytes from 0x60
  LNVOroot@t1042d4rdb:~#
  ^^^^

so far, so good. now try to write a new 4-byte string to that same
location:

  # echo -n "RDAY" | eeprog /dev/i2c-0 0x50 -16 -f -w 0x60
  eeprog 0.7.5, a 24Cxx EEPROM reader/writer
  Copyright (c) 2003 by Stefano Barbato - All rights reserved.
    Bus: /dev/i2c-0, Address: 0x50, Mode: 16bit
    Writing stdin starting at address 0x60
  ..Error i2c_write_3b: No such device or address
  Error at line 162: write error
  root@t1042d4rdb:~#

from what i read on the man page, the above should work. weirdly, if i
dump that address again, the first byte has been overwritten:

  # eeprog /dev/i2c-0 0x50 -16 -f -r 0x60:4
  eeprog 0.7.5, a 24Cxx EEPROM reader/writer
  Copyright (c) 2003 by Stefano Barbato - All rights reserved.
    Bus: /dev/i2c-0, Address: 0x50, Mode: 16bit
    Reading 4 bytes from 0x60
  RNVOroot@t1042d4rdb:~#
  ^

at which point, yes, i can write one byte at a time:

  # echo -n "D" | eeprog /dev/i2c-0 0x50 -16 -f -w 0x61
  eeprog 0.7.5, a 24Cxx EEPROM reader/writer
  Copyright (c) 2003 by Stefano Barbato - All rights reserved.
    Bus: /dev/i2c-0, Address: 0x50, Mode: 16bit
    Writing stdin starting at address 0x61

and sure enough, the memory contents are now "RDVO".

  i'm baffled, and open to suggestions.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux