I2C HELP!!!!

Started by power_overwhelming_4 September 7, 2004
Here is the problem:
I attempted to establish serial communications between my BX-24 chip
and a PIC16F877 using the I2C code in this site. I configured the BX-
24 as master and the other as slave, with the master periodically
reading some values from the slave. To check if the data BX-24 reads
is correct, I instructed the BX to print whatever data it reads from
the slave. When I first attempted I2C a problem existed: the BX-24
always reads 255! I don't know what caused this; it happened several
times and i kept on checking what is wrong with my hardware
connections or software. Eventually the problem disappeared in my
subsequent tests (the slave is used to decode encoder readings for a
robot and send that as feedback to BX-24). With the BX-24 and PIC
properly programmed and the hardware connections right, the I2C run
smoothly. I used 1.8K pull-ups in that. I never knew the cause.
Since then I got the impression that the cause of the problem is
hardware-related, like if the SDA and SCL pins are connected at the
wrong pins on both devices or the two devices are not synchronized in
SCL line or the I2C lines of the master are open. However, the
problem later recurred to me. The BX-24 seems to be reading 255
again from the PIC. I checked all hardware connections especially
the pin connections if they are right and they are correct indeed. I
don't know how to correct it. I applied the same codes as I did when
I2c ran right back then. I have a feeling that it is still harware-
related, but i don't know exactly the cause.

Why does my BX-24 master always get only 255 from the I2C bus?
What exactly causes it?
How can it be avoided?



Why not ditch the I2C and use synchronous serial? On Sep 7, 2004, at 6:15 AM, power_overwhelming_4 wrote:

> Here is the problem:
> I attempted to establish serial communications between my BX-24 chip
> and a PIC16F877 using the I2C code in this site. I configured the BX-
> 24 as master and the other as slave, with the master periodically
> reading some values from the slave. To check if the data BX-24 reads
> is correct, I instructed the BX to print whatever data it reads from
> the slave. When I first attempted I2C a problem existed: the BX-24
> always reads 255! I don't know what caused this; it happened several
> times and i kept on checking what is wrong with my hardware
> connections or software. Eventually the problem disappeared in my
> subsequent tests (the slave is used to decode encoder readings for a
> robot and send that as feedback to BX-24). With the BX-24 and PIC
> properly programmed and the hardware connections right, the I2C run
> smoothly. I used 1.8K pull-ups in that. I never knew the cause.
> Since then I got the impression that the cause of the problem is
> hardware-related, like if the SDA and SCL pins are connected at the
> wrong pins on both devices or the two devices are not synchronized in
> SCL line or the I2C lines of the master are open. However, the
> problem later recurred to me. The BX-24 seems to be reading 255
> again from the PIC. I checked all hardware connections especially
> the pin connections if they are right and they are correct indeed. I
> don't know how to correct it. I applied the same codes as I did when
> I2c ran right back then. I have a feeling that it is still harware-
> related, but i don't know exactly the cause.
>
> Why does my BX-24 master always get only 255 from the I2C bus?
> What exactly causes it?
> How can it be avoided? > Yahoo! Groups Links >
--
Tom Igoe


It was I while since I did I2C-comm and I don't have my code at hand.

But to me it sounds like the PIC is not answering. If the slave
doesn't answer and the master still read the expected input it will
allways be ones (i.e 255), as the dataline remains high because no
slave is feeding it with data.

/Ingvar

--- In , "power_overwhelming_4"
<power_overwhelming_4@y...> wrote:
> Here is the problem:
> I attempted to establish serial communications between my BX-24
chip
> and a PIC16F877 using the I2C code in this site. I configured the
BX-
> 24 as master and the other as slave, with the master periodically
> reading some values from the slave. To check if the data BX-24
reads
> is correct, I instructed the BX to print whatever data it reads
from
> the slave. When I first attempted I2C a problem existed: the BX-
24
> always reads 255! I don't know what caused this; it happened
several
> times and i kept on checking what is wrong with my hardware
> connections or software. Eventually the problem disappeared in my
> subsequent tests (the slave is used to decode encoder readings for
a
> robot and send that as feedback to BX-24). With the BX-24 and PIC
> properly programmed and the hardware connections right, the I2C
run
> smoothly. I used 1.8K pull-ups in that. I never knew the cause.
> Since then I got the impression that the cause of the problem is
> hardware-related, like if the SDA and SCL pins are connected at
the
> wrong pins on both devices or the two devices are not synchronized
in
> SCL line or the I2C lines of the master are open. However, the
> problem later recurred to me. The BX-24 seems to be reading 255
> again from the PIC. I checked all hardware connections
especially
> the pin connections if they are right and they are correct
indeed. I
> don't know how to correct it. I applied the same codes as I did
when
> I2c ran right back then. I have a feeling that it is still
harware-
> related, but i don't know exactly the cause.
>
> Why does my BX-24 master always get only 255 from the I2C bus?
> What exactly causes it?
> How can it be avoided?





Then maybe I should replace my slave IC with a new one?

--- In , "Ingvar Esk" <ingvar.esk@s...> wrote:
> It was I while since I did I2C-comm and I don't have my code at
hand.
>
> But to me it sounds like the PIC is not answering. If the slave
> doesn't answer and the master still read the expected input it will
> allways be ones (i.e 255), as the dataline remains high because no
> slave is feeding it with data.
>
> /Ingvar
>
> --- In , "power_overwhelming_4"
> <power_overwhelming_4@y...> wrote:
> > Here is the problem:
> > I attempted to establish serial communications between my BX-24
> chip
> > and a PIC16F877 using the I2C code in this site. I configured
the
> BX-
> > 24 as master and the other as slave, with the master periodically
> > reading some values from the slave. To check if the data BX-24
> reads
> > is correct, I instructed the BX to print whatever data it reads
> from
> > the slave. When I first attempted I2C a problem existed: the BX-
> 24
> > always reads 255! I don't know what caused this; it happened
> several
> > times and i kept on checking what is wrong with my hardware
> > connections or software. Eventually the problem disappeared in
my
> > subsequent tests (the slave is used to decode encoder readings
for
> a
> > robot and send that as feedback to BX-24). With the BX-24 and
PIC
> > properly programmed and the hardware connections right, the I2C
> run
> > smoothly. I used 1.8K pull-ups in that. I never knew the
cause.
> > Since then I got the impression that the cause of the problem is
> > hardware-related, like if the SDA and SCL pins are connected at
> the
> > wrong pins on both devices or the two devices are not
synchronized
> in
> > SCL line or the I2C lines of the master are open. However, the
> > problem later recurred to me. The BX-24 seems to be reading 255
> > again from the PIC. I checked all hardware connections
> especially
> > the pin connections if they are right and they are correct
> indeed. I
> > don't know how to correct it. I applied the same codes as I did
> when
> > I2c ran right back then. I have a feeling that it is still
> harware-
> > related, but i don't know exactly the cause.
> >
> > Why does my BX-24 master always get only 255 from the I2C bus?
> > What exactly causes it?
> > How can it be avoided?





I don't think damaged hw is the first thing to come to mind.

How about the I2C SW in the PIC or in the BX24. No bugs there? How
about timing issues? Could one of the chips be to fast for the other?

You may have to debug your code. Do you receive any ACK-signal from
the slave?

Timing error can be hard to detect. You say it has worked, so it
could be on the edge. Small delays at one side or the other might
solve it or point out where the problem is.

Good luck
Ingvar

--- In , "power_overwhelming_4"
<power_overwhelming_4@y...> wrote:
> Then maybe I should replace my slave IC with a new one?
>
> --- In , "Ingvar Esk" <ingvar.esk@s...>
wrote:
> > It was I while since I did I2C-comm and I don't have my code at
> hand.
> >
> > But to me it sounds like the PIC is not answering. If the slave
> > doesn't answer and the master still read the expected input it
will
> > allways be ones (i.e 255), as the dataline remains high because
no
> > slave is feeding it with data.
> >
> > /Ingvar
> >
> > --- In , "power_overwhelming_4"
> > <power_overwhelming_4@y...> wrote:
> > > Here is the problem:
> > > I attempted to establish serial communications between my BX-
24
> > chip
> > > and a PIC16F877 using the I2C code in this site. I configured
> the
> > BX-
> > > 24 as master and the other as slave, with the master
periodically
> > > reading some values from the slave. To check if the data BX-
24
> > reads
> > > is correct, I instructed the BX to print whatever data it
reads
> > from
> > > the slave. When I first attempted I2C a problem existed: the
BX-
> > 24
> > > always reads 255! I don't know what caused this; it happened
> > several
> > > times and i kept on checking what is wrong with my hardware
> > > connections or software. Eventually the problem disappeared
in
> my
> > > subsequent tests (the slave is used to decode encoder readings
> for
> > a
> > > robot and send that as feedback to BX-24). With the BX-24 and
> PIC
> > > properly programmed and the hardware connections right, the
I2C
> > run
> > > smoothly. I used 1.8K pull-ups in that. I never knew the
> cause.
> > > Since then I got the impression that the cause of the problem
is
> > > hardware-related, like if the SDA and SCL pins are connected
at
> > the
> > > wrong pins on both devices or the two devices are not
> synchronized
> > in
> > > SCL line or the I2C lines of the master are open. However,
the
> > > problem later recurred to me. The BX-24 seems to be reading
255
> > > again from the PIC. I checked all hardware connections
> > especially
> > > the pin connections if they are right and they are correct
> > indeed. I
> > > don't know how to correct it. I applied the same codes as I
did
> > when
> > > I2c ran right back then. I have a feeling that it is still
> > harware-
> > > related, but i don't know exactly the cause.
> > >
> > > Why does my BX-24 master always get only 255 from the I2C bus?
> > > What exactly causes it?
> > > How can it be avoided?





I am currently trying to solve the I2C problem based on your
suggestion on timing delays. Somehow some thoughts keep popping on
me. Since the BasicX datasheet says the chip can process about
65000 Basic instructions per second, isn't it slower than my PIC
slave, which runs at 8MHz? Since the BasicX is the master, it
generates the clock (bit-banged clock), and since it is slower than
PIC, the PIC should be able to cope with BX and the two be
synchronized to each other. Do you think what I'm saying is true?

On the other hand, regarding the problem i stated, i forgot to
mention something: Aside from 255, the BX also keeps on receiving
(and displaying) 0, so in effect the Downloader screen keeps on
showing:

255
0
255
0
0
255
255
0
255
...

What may have caused it exactly? Any suggestions? --- In , "Ingvar Esk" <ingvar.esk@s...> wrote:
> I don't think damaged hw is the first thing to come to mind.
>
> How about the I2C SW in the PIC or in the BX24. No bugs there? How
> about timing issues? Could one of the chips be to fast for the
other?
>
> You may have to debug your code. Do you receive any ACK-signal
from
> the slave?
>
> Timing error can be hard to detect. You say it has worked, so it
> could be on the edge. Small delays at one side or the other might
> solve it or point out where the problem is.
>
> Good luck
> Ingvar
>
> --- In , "power_overwhelming_4"
> <power_overwhelming_4@y...> wrote:
> > Then maybe I should replace my slave IC with a new one?
> >
> > --- In , "Ingvar Esk" <ingvar.esk@s...>
> wrote:
> > > It was I while since I did I2C-comm and I don't have my code
at
> > hand.
> > >
> > > But to me it sounds like the PIC is not answering. If the
slave
> > > doesn't answer and the master still read the expected input it
> will
> > > allways be ones (i.e 255), as the dataline remains high
because
> no
> > > slave is feeding it with data.
> > >
> > > /Ingvar
> > >
> > > --- In , "power_overwhelming_4"
> > > <power_overwhelming_4@y...> wrote:
> > > > Here is the problem:
> > > > I attempted to establish serial communications between my BX-
> 24
> > > chip
> > > > and a PIC16F877 using the I2C code in this site. I
configured
> > the
> > > BX-
> > > > 24 as master and the other as slave, with the master
> periodically
> > > > reading some values from the slave. To check if the data BX-
> 24
> > > reads
> > > > is correct, I instructed the BX to print whatever data it
> reads
> > > from
> > > > the slave. When I first attempted I2C a problem existed:
the
> BX-
> > > 24
> > > > always reads 255! I don't know what caused this; it
happened
> > > several
> > > > times and i kept on checking what is wrong with my hardware
> > > > connections or software. Eventually the problem disappeared
> in
> > my
> > > > subsequent tests (the slave is used to decode encoder
readings
> > for
> > > a
> > > > robot and send that as feedback to BX-24). With the BX-24
and
> > PIC
> > > > properly programmed and the hardware connections right, the
> I2C
> > > run
> > > > smoothly. I used 1.8K pull-ups in that. I never knew the
> > cause.
> > > > Since then I got the impression that the cause of the
problem
> is
> > > > hardware-related, like if the SDA and SCL pins are connected
> at
> > > the
> > > > wrong pins on both devices or the two devices are not
> > synchronized
> > > in
> > > > SCL line or the I2C lines of the master are open. However,
> the
> > > > problem later recurred to me. The BX-24 seems to be reading
> 255
> > > > again from the PIC. I checked all hardware connections
> > > especially
> > > > the pin connections if they are right and they are correct
> > > indeed. I
> > > > don't know how to correct it. I applied the same codes as I
> did
> > > when
> > > > I2c ran right back then. I have a feeling that it is still
> > > harware-
> > > > related, but i don't know exactly the cause.
> > > >
> > > > Why does my BX-24 master always get only 255 from the I2C
bus?
> > > > What exactly causes it?
> > > > How can it be avoided?





I haven't tried getting a BasicX to Talk to a PIC but I have had both a PIC
and BasicX talking via I2c to a LCD from Matrix Orbital. I have little
experience with assembler so I used a (Basic to Assembler) compiler from
Crownhill Associates and it contains functions for communicating with I2c.
(w ww.letbasic.com) it's cheap and complements the BasicX very well.
I am a little confused about your choice of clock speed. Why did you use
8mhz instead of 4mhz or 10mhz or 20mhz ?
I also think you may have a timing issue.
Harry

-----Original Message-----
From: power_overwhelming_4 [mailto:]
Sent: Wednesday, September 08, 2004 11:02 PM
To:
Subject: [BasicX] Re: I2C HELP!!!!

I am currently trying to solve the I2C problem based on your suggestion on
timing delays. Somehow some thoughts keep popping on me. Since the BasicX
datasheet says the chip can process about 65000 Basic instructions per
second, isn't it slower than my PIC slave, which runs at 8MHz? Since the
BasicX is the master, it generates the clock (bit-banged clock), and since
it is slower than PIC, the PIC should be able to cope with BX and the two be
synchronized to each other. Do you think what I'm saying is true?

On the other hand, regarding the problem i stated, i forgot to mention
something: Aside from 255, the BX also keeps on receiving (and displaying)
0, so in effect the Downloader screen keeps on
showing:

255
0
255
0
0
255
255
0
255
...

What may have caused it exactly? Any suggestions? --- In , "Ingvar Esk" <ingvar.esk@s...> wrote:
> I don't think damaged hw is the first thing to come to mind.
>
> How about the I2C SW in the PIC or in the BX24. No bugs there? How
> about timing issues? Could one of the chips be to fast for the
other?
>
> You may have to debug your code. Do you receive any ACK-signal
from
> the slave?
>
> Timing error can be hard to detect. You say it has worked, so it could
> be on the edge. Small delays at one side or the other might solve it
> or point out where the problem is.
>
> Good luck
> Ingvar
>
> --- In , "power_overwhelming_4"
> <power_overwhelming_4@y...> wrote:
> > Then maybe I should replace my slave IC with a new one?
> >
> > --- In , "Ingvar Esk" <ingvar.esk@s...>
> wrote:
> > > It was I while since I did I2C-comm and I don't have my code
at
> > hand.
> > >
> > > But to me it sounds like the PIC is not answering. If the
slave
> > > doesn't answer and the master still read the expected input it
> will
> > > allways be ones (i.e 255), as the dataline remains high
because
> no
> > > slave is feeding it with data.
> > >
> > > /Ingvar
> > >
> > > --- In , "power_overwhelming_4"
> > > <power_overwhelming_4@y...> wrote:
> > > > Here is the problem:
> > > > I attempted to establish serial communications between my BX-
> 24
> > > chip
> > > > and a PIC16F877 using the I2C code in this site. I
configured
> > the
> > > BX-
> > > > 24 as master and the other as slave, with the master
> periodically
> > > > reading some values from the slave. To check if the data BX-
> 24
> > > reads
> > > > is correct, I instructed the BX to print whatever data it
> reads
> > > from
> > > > the slave. When I first attempted I2C a problem existed:
the
> BX-
> > > 24
> > > > always reads 255! I don't know what caused this; it
happened
> > > several
> > > > times and i kept on checking what is wrong with my hardware
> > > > connections or software. Eventually the problem disappeared
> in
> > my
> > > > subsequent tests (the slave is used to decode encoder
readings
> > for
> > > a
> > > > robot and send that as feedback to BX-24). With the BX-24
and
> > PIC
> > > > properly programmed and the hardware connections right, the
> I2C
> > > run
> > > > smoothly. I used 1.8K pull-ups in that. I never knew the
> > cause.
> > > > Since then I got the impression that the cause of the
problem
> is
> > > > hardware-related, like if the SDA and SCL pins are connected
> at
> > > the
> > > > wrong pins on both devices or the two devices are not
> > synchronized
> > > in
> > > > SCL line or the I2C lines of the master are open. However,
> the
> > > > problem later recurred to me. The BX-24 seems to be reading
> 255
> > > > again from the PIC. I checked all hardware connections
> > > especially
> > > > the pin connections if they are right and they are correct
> > > indeed. I
> > > > don't know how to correct it. I applied the same codes as I
> did
> > > when
> > > > I2c ran right back then. I have a feeling that it is still
> > > harware-
> > > > related, but i don't know exactly the cause.
> > > >
> > > > Why does my BX-24 master always get only 255 from the I2C
bus?
> > > > What exactly causes it?
> > > > How can it be avoided?
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/dN_tlB/TM
--------------------------------~- Yahoo! Groups Links


--- In , "power_overwhelming_4"
<power_overwhelming_4@y...> wrote:
> I am currently trying to solve the I2C problem based on your
> suggestion on timing delays. Somehow some thoughts keep popping
on
> me. Since the BasicX datasheet says the chip can process about
> 65000 Basic instructions per second, isn't it slower than my PIC
> slave, which runs at 8MHz? Since the BasicX is the master, it
> generates the clock (bit-banged clock), and since it is slower
than
> PIC, the PIC should be able to cope with BX and the two be
> synchronized to each other. Do you think what I'm saying is true?

Yes, it seems reasonable. But even if the PIC is faster per
instruction, that doesn't help if there is a bug or not so well
written chunk of code using many cycles for a bit banging operation.

>
> On the other hand, regarding the problem i stated, i forgot to
> mention something: Aside from 255, the BX also keeps on receiving
> (and displaying) 0, so in effect the Downloader screen keeps on
> showing:
>
> 255
> 0
> 255
> 0
> 0
> 255
> 255
> 0
> 255
> ...
>
> What may have caused it exactly? Any suggestions?

Do you receive a proper ACK signal after addressing the PIC? Well,
when I think of it, it depends on how you have implemented the I2C
slave SW. In I2C-communication you start by sending an address and
the slave returns an ACK, then you send a command etc. It's
important to know if you receive proper ACK signals. If not, nothing
will be reliable.

Ingvar
>
>
> --- In , "Ingvar Esk" <ingvar.esk@s...>
wrote:
> > I don't think damaged hw is the first thing to come to mind.
> >
> > How about the I2C SW in the PIC or in the BX24. No bugs there?
How
> > about timing issues? Could one of the chips be to fast for the
> other?
> >
> > You may have to debug your code. Do you receive any ACK-signal
> from
> > the slave?
> >
> > Timing error can be hard to detect. You say it has worked, so it
> > could be on the edge. Small delays at one side or the other
might
> > solve it or point out where the problem is.
> >
> > Good luck
> > Ingvar
> >
> > --- In , "power_overwhelming_4"
> > <power_overwhelming_4@y...> wrote:
> > > Then maybe I should replace my slave IC with a new one?
> > >
> > > --- In , "Ingvar Esk" <ingvar.esk@s...>
> > wrote:
> > > > It was I while since I did I2C-comm and I don't have my code
> at
> > > hand.
> > > >
> > > > But to me it sounds like the PIC is not answering. If the
> slave
> > > > doesn't answer and the master still read the expected input
it
> > will
> > > > allways be ones (i.e 255), as the dataline remains high
> because
> > no
> > > > slave is feeding it with data.
> > > >
> > > > /Ingvar
> > > >
> > > > --- In , "power_overwhelming_4"
> > > > <power_overwhelming_4@y...> wrote:
> > > > > Here is the problem:
> > > > > I attempted to establish serial communications between my
BX-
> > 24
> > > > chip
> > > > > and a PIC16F877 using the I2C code in this site. I
> configured
> > > the
> > > > BX-
> > > > > 24 as master and the other as slave, with the master
> > periodically
> > > > > reading some values from the slave. To check if the data
BX-
> > 24
> > > > reads
> > > > > is correct, I instructed the BX to print whatever data it
> > reads
> > > > from
> > > > > the slave. When I first attempted I2C a problem existed:
> the
> > BX-
> > > > 24
> > > > > always reads 255! I don't know what caused this; it
> happened
> > > > several
> > > > > times and i kept on checking what is wrong with my
hardware
> > > > > connections or software. Eventually the problem
disappeared
> > in
> > > my
> > > > > subsequent tests (the slave is used to decode encoder
> readings
> > > for
> > > > a
> > > > > robot and send that as feedback to BX-24). With the BX-24
> and
> > > PIC
> > > > > properly programmed and the hardware connections right,
the
> > I2C
> > > > run
> > > > > smoothly. I used 1.8K pull-ups in that. I never knew the
> > > cause.
> > > > > Since then I got the impression that the cause of the
> problem
> > is
> > > > > hardware-related, like if the SDA and SCL pins are
connected
> > at
> > > > the
> > > > > wrong pins on both devices or the two devices are not
> > > synchronized
> > > > in
> > > > > SCL line or the I2C lines of the master are open.
However,
> > the
> > > > > problem later recurred to me. The BX-24 seems to be
reading
> > 255
> > > > > again from the PIC. I checked all hardware connections
> > > > especially
> > > > > the pin connections if they are right and they are correct
> > > > indeed. I
> > > > > don't know how to correct it. I applied the same codes as
I
> > did
> > > > when
> > > > > I2c ran right back then. I have a feeling that it is
still
> > > > harware-
> > > > > related, but i don't know exactly the cause.
> > > > >
> > > > > Why does my BX-24 master always get only 255 from the I2C
> bus?
> > > > > What exactly causes it?
> > > > > How can it be avoided?





I've tested it, I included a routine that obtained the value of SDA
right after sending the slave address and during the high level of
the 9th SCL. I found that the slave indeed is not responding!!
Because the SDA at that time (slave Ack) is 1 (NACK)!!!

Any suggestions? Does the BasicX-24 code from this yahoogroup
includes a provision for clock-stretching, since the master I2C
routine is bit-banged? What can you suggest about the timing issues
or delay routines? I plan to use oscilloscope and uncover the
status flags of PIC slave while at I2C to look for some clues. I am
not very familiar in programming of some things that are timing-
sensitive, and i would appreciate any help from you.
--- In , "Ingvar Esk" <ingvar.esk@s...> wrote:
> --- In , "power_overwhelming_4"
> <power_overwhelming_4@y...> wrote:
> > I am currently trying to solve the I2C problem based on your
> > suggestion on timing delays. Somehow some thoughts keep popping
> on
> > me. Since the BasicX datasheet says the chip can process about
> > 65000 Basic instructions per second, isn't it slower than my PIC
> > slave, which runs at 8MHz? Since the BasicX is the master, it
> > generates the clock (bit-banged clock), and since it is slower
> than
> > PIC, the PIC should be able to cope with BX and the two be
> > synchronized to each other. Do you think what I'm saying is
true?
>
> Yes, it seems reasonable. But even if the PIC is faster per
> instruction, that doesn't help if there is a bug or not so well
> written chunk of code using many cycles for a bit banging
operation.
>
> >
> > On the other hand, regarding the problem i stated, i forgot to
> > mention something: Aside from 255, the BX also keeps on
receiving
> > (and displaying) 0, so in effect the Downloader screen keeps on
> > showing:
> >
> > 255
> > 0
> > 255
> > 0
> > 0
> > 255
> > 255
> > 0
> > 255
> > ...
> >
> > What may have caused it exactly? Any suggestions?
>
> Do you receive a proper ACK signal after addressing the PIC? Well,
> when I think of it, it depends on how you have implemented the I2C
> slave SW. In I2C-communication you start by sending an address and
> the slave returns an ACK, then you send a command etc. It's
> important to know if you receive proper ACK signals. If not,
nothing
> will be reliable.
>
> Ingvar
> >
> >
> > --- In , "Ingvar Esk" <ingvar.esk@s...>
> wrote:
> > > I don't think damaged hw is the first thing to come to mind.
> > >
> > > How about the I2C SW in the PIC or in the BX24. No bugs there?
> How
> > > about timing issues? Could one of the chips be to fast for the
> > other?
> > >
> > > You may have to debug your code. Do you receive any ACK-signal
> > from
> > > the slave?
> > >
> > > Timing error can be hard to detect. You say it has worked, so
it
> > > could be on the edge. Small delays at one side or the other
> might
> > > solve it or point out where the problem is.
> > >
> > > Good luck
> > > Ingvar
> > >
> > > --- In , "power_overwhelming_4"
> > > <power_overwhelming_4@y...> wrote:
> > > > Then maybe I should replace my slave IC with a new one?
> > > >
> > > > --- In , "Ingvar Esk"
<ingvar.esk@s...>
> > > wrote:
> > > > > It was I while since I did I2C-comm and I don't have my
code
> > at
> > > > hand.
> > > > >
> > > > > But to me it sounds like the PIC is not answering. If the
> > slave
> > > > > doesn't answer and the master still read the expected
input
> it
> > > will
> > > > > allways be ones (i.e 255), as the dataline remains high
> > because
> > > no
> > > > > slave is feeding it with data.
> > > > >
> > > > > /Ingvar
> > > > >
> > > > > --- In , "power_overwhelming_4"
> > > > > <power_overwhelming_4@y...> wrote:
> > > > > > Here is the problem:
> > > > > > I attempted to establish serial communications between
my
> BX-
> > > 24
> > > > > chip
> > > > > > and a PIC16F877 using the I2C code in this site. I
> > configured
> > > > the
> > > > > BX-
> > > > > > 24 as master and the other as slave, with the master
> > > periodically
> > > > > > reading some values from the slave. To check if the
data
> BX-
> > > 24
> > > > > reads
> > > > > > is correct, I instructed the BX to print whatever data
it
> > > reads
> > > > > from
> > > > > > the slave. When I first attempted I2C a problem
existed:
> > the
> > > BX-
> > > > > 24
> > > > > > always reads 255! I don't know what caused this; it
> > happened
> > > > > several
> > > > > > times and i kept on checking what is wrong with my
> hardware
> > > > > > connections or software. Eventually the problem
> disappeared
> > > in
> > > > my
> > > > > > subsequent tests (the slave is used to decode encoder
> > readings
> > > > for
> > > > > a
> > > > > > robot and send that as feedback to BX-24). With the BX-
24
> > and
> > > > PIC
> > > > > > properly programmed and the hardware connections right,
> the
> > > I2C
> > > > > run
> > > > > > smoothly. I used 1.8K pull-ups in that. I never knew
the
> > > > cause.
> > > > > > Since then I got the impression that the cause of the
> > problem
> > > is
> > > > > > hardware-related, like if the SDA and SCL pins are
> connected
> > > at
> > > > > the
> > > > > > wrong pins on both devices or the two devices are not
> > > > synchronized
> > > > > in
> > > > > > SCL line or the I2C lines of the master are open.
> However,
> > > the
> > > > > > problem later recurred to me. The BX-24 seems to be
> reading
> > > 255
> > > > > > again from the PIC. I checked all hardware connections
> > > > > especially
> > > > > > the pin connections if they are right and they are
correct
> > > > > indeed. I
> > > > > > don't know how to correct it. I applied the same codes
as
> I
> > > did
> > > > > when
> > > > > > I2c ran right back then. I have a feeling that it is
> still
> > > > > harware-
> > > > > > related, but i don't know exactly the cause.
> > > > > >
> > > > > > Why does my BX-24 master always get only 255 from the
I2C
> > bus?
> > > > > > What exactly causes it?
> > > > > > How can it be avoided?