linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* can't write more than one byte to AT24C64 EEPROM using "eeprog"
@ 2017-07-25 12:51 rpjday
  2017-07-25 17:51 ` Robert P. J. Day
  0 siblings, 1 reply; 8+ messages in thread
From: rpjday @ 2017-07-25 12:51 UTC (permalink / raw)
  To: linux-i2c


   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.

rday

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: can't write more than one byte to AT24C64 EEPROM using "eeprog"
  2017-07-25 12:51 can't write more than one byte to AT24C64 EEPROM using "eeprog" rpjday
@ 2017-07-25 17:51 ` Robert P. J. Day
  2017-07-26 18:30   ` Robert P. J. Day
  0 siblings, 1 reply; 8+ messages in thread
From: Robert P. J. Day @ 2017-07-25 17:51 UTC (permalink / raw)
  To: linux-i2c


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

On Tue, 25 Jul 2017, rpjday@crashcourse.ca 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
========================================================================

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: can't write more than one byte to AT24C64 EEPROM using "eeprog"
  2017-07-25 17:51 ` Robert P. J. Day
@ 2017-07-26 18:30   ` Robert P. J. Day
  2017-07-26 20:57     ` Wolfram Sang
  0 siblings, 1 reply; 8+ messages in thread
From: Robert P. J. Day @ 2017-07-26 18:30 UTC (permalink / raw)
  To: linux-i2c


  i've tossed all the previous post since it appears(?) i've
discovered the issue, which is explained here:

https://www.toradex.com/community/questions/10243/write-issue-with-eeprog-in-eeprom.html

if i read that correctly, "eeprog" is not leaving anywhere *near*
enough time for a byte write to complete, with a patch suggested here:

https://share.toradex.com/s07bedxtxfdc4wj?direct

that cranks up the wait period from 10 usec to 5 msec. does this make
sense, since that is *exactly* the symptom i'm seeing.

  thoughts? is no one else seeing this issue?

rday

-- 

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: can't write more than one byte to AT24C64 EEPROM using "eeprog"
  2017-07-26 18:30   ` Robert P. J. Day
@ 2017-07-26 20:57     ` Wolfram Sang
  2017-07-26 21:31       ` Robert P. J. Day
  2017-07-27  8:40       ` Robert P. J. Day
  0 siblings, 2 replies; 8+ messages in thread
From: Wolfram Sang @ 2017-07-26 20:57 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: linux-i2c

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]


>   thoughts? is no one else seeing this issue?

Just for the record: I always use the kernel at24 driver for eeproms and
haven't used those tools for ages. I could imagine this is true for most
people and would explain undiscovered bugs and bitrot.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: can't write more than one byte to AT24C64 EEPROM using "eeprog"
  2017-07-26 20:57     ` Wolfram Sang
@ 2017-07-26 21:31       ` Robert P. J. Day
  2017-07-26 21:57         ` Wolfram Sang
  2017-07-27  8:40       ` Robert P. J. Day
  1 sibling, 1 reply; 8+ messages in thread
From: Robert P. J. Day @ 2017-07-26 21:31 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c

On Wed, 26 Jul 2017, Wolfram Sang wrote:

> >   thoughts? is no one else seeing this issue?
>
> Just for the record: I always use the kernel at24 driver for eeproms
> and haven't used those tools for ages. I could imagine this is true
> for most people and would explain undiscovered bugs and bitrot.

  i'm not even sure what that means ... how do you distinguish between
the kernel drivers and the user space utilities?

rday

-- 

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: can't write more than one byte to AT24C64 EEPROM using "eeprog"
  2017-07-26 21:31       ` Robert P. J. Day
@ 2017-07-26 21:57         ` Wolfram Sang
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2017-07-26 21:57 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: linux-i2c

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]


>   i'm not even sure what that means ... how do you distinguish between
> the kernel drivers and the user space utilities?

The kernel drivers provide you an 'eeprom' file in sysfs.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: can't write more than one byte to AT24C64 EEPROM using "eeprog"
  2017-07-26 20:57     ` Wolfram Sang
  2017-07-26 21:31       ` Robert P. J. Day
@ 2017-07-27  8:40       ` Robert P. J. Day
  2017-07-27  9:34         ` Wolfram Sang
  1 sibling, 1 reply; 8+ messages in thread
From: Robert P. J. Day @ 2017-07-27  8:40 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c

On Wed, 26 Jul 2017, Wolfram Sang wrote:

> >   thoughts? is no one else seeing this issue?
>
> Just for the record: I always use the kernel at24 driver for eeproms
> and haven't used those tools for ages. I could imagine this is true
> for most people and would explain undiscovered bugs and bitrot.

  so, just for the record, you're saying i should have no expectation
that these tools work properly? that's kind of disappointing.

rday

-- 

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: can't write more than one byte to AT24C64 EEPROM using "eeprog"
  2017-07-27  8:40       ` Robert P. J. Day
@ 2017-07-27  9:34         ` Wolfram Sang
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2017-07-27  9:34 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: linux-i2c

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]


>   so, just for the record, you're saying i should have no expectation
> that these tools work properly? that's kind of disappointing.

Nope, I am not saying that. I am saying that if you ask questions
about these tools, you might not find a lot of other users for
discussion. And for the same reason you *might* find bugs undiscovered
so far; I am not saying you *will* find bugs.

Your work on or interest in these tools is much appreciated. I just
wanted to describe the area you entered and the reasons why there are
maybe not much responses.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-07-27  9:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-25 12:51 can't write more than one byte to AT24C64 EEPROM using "eeprog" rpjday
2017-07-25 17:51 ` Robert P. J. Day
2017-07-26 18:30   ` Robert P. J. Day
2017-07-26 20:57     ` Wolfram Sang
2017-07-26 21:31       ` Robert P. J. Day
2017-07-26 21:57         ` Wolfram Sang
2017-07-27  8:40       ` Robert P. J. Day
2017-07-27  9:34         ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).