public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andrew Dyer <amdyer@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] ack problem in common/soft_i2c.c?
Date: Mon, 11 Jul 2005 18:05:23 -0500	[thread overview]
Message-ID: <c166aa9f05071116052149024b@mail.gmail.com> (raw)

I am working with the soft i2c code on my target and I believe
there is a problem in the send_ack() function.

My hardware (au1550) uses standard push-pull drivers which
can be tri-stated by changing them to inputs, so I have
I2C_ACTIVE and I2C_TRISTATE defined as per the README.

When reading the real time clock (ST M41T60) on my board
I could never get 8 successive reads of the device to complete.
Somewhere in the middle of reading the data the clock would
start returning 0xff.  If I read the registers one at a time, it
worked fine.

read_byte() leaves the clock high at the end of shifting in the
read data.  usually the internal state of the data out register on
the CPU was low from generating the last ack and the data line
is tristate on the CPU (done at the start of read_byte()).
The physical data line is in an unknown state depending on
the last data bit read.

Looking at the beginning of the send_ack() code it goes:

I2C_ACTIVE;
I2C_SCL(0);
I2C_DELAY;

If the external data line is high and the internal register for the I/O
on the CPU is low, this will generate a repeated start condition.
It might be missed by a lot of parts since the edges happen with
minimal delay in between.

In my case changing the order to:

I2C_SCL(0);
I2C_DELAY;
I2C_ACTIVE;

seems to fix my issues.  Unfortunately due to internal CVS/firewall/VPN 
issues I can't get a patch together easily right now.


-- 
Hardware, n.:
        The parts of a computer system that can be kicked.

             reply	other threads:[~2005-07-11 23:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-11 23:05 Andrew Dyer [this message]
2005-07-12  7:07 ` AW: [U-Boot-Users] ack problem in common/soft_i2c.c? Reinhard Meyer
2005-07-22 11:38 ` Thomas Kastner
2005-07-26 18:42   ` [U-Boot-Users] PATCH was(ack problem in common/soft_i2c.c) Andrew Dyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c166aa9f05071116052149024b@mail.gmail.com \
    --to=amdyer@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox