Searching \ for '[PIC]: [EE]: Inconsistent I2C behavior' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/i2cs.htm?key=i2c
Search entire site for: '[EE]: Inconsistent I2C behavior'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: [EE]: Inconsistent I2C behavior'
2006\07\14@174741 by Marty Robertson

picon face
Hello Everyone,

     I am using a PIC 18F2520's MSSP configured as an I2C master.  It is
interfacing a DAC that takes a 3 byte packet to write to (Address, Data1,
Data2).  Generally it is working.  I'm generating arbitrary waveforms with
no problem...  when it works.  What I mean is that if I power cycle the
unit, it comes up just fine and begins outputting waveforms to the DAC about
90% of the time.

    Looking at it one the scope I see two different distinct error
states.    SCL would normally generate 9 clocks for each of the 3 bytes (8
bits data, 1 bit ack) and it is all in a packet surround by start and stop
conditions.  When it is doing this, all is well.  However, during10% of the
time I see one of 2 things..     either the clock idles low (should be high)
and then during the first byte it only puts out a clock on the first bit.
Then when it gets to the second and third bytes it does the full 9 clocks
each but returns to a low state.  The other part of the time both lines are
held high and seemingly nothing happens.

     Whichever state I power up in the unit stays in.  Just before anyone
asks, I have 1K resistors pulling SCL and SDA up.  I have the same circuit
hooked up on a dev board and it doesn't have any issues like this.  Does
anyone have any ideas what might be causing this?

Thank you,

Martin

2006\07\14@180438 by Marty Robertson

picon face
part 1 538 bytes content-type:text/plain; charset=ISO-8859-1; format=flowed (decoded 7bit)

Sorry to reply to my own message, but I just noticed that I had told you
guys wrong.  Referring to the error state above where the clock is idling
low and not clocking correctly...      What is actually happening (sorry for
the confusion) is that the first bit is put out, then there is a long delay
(the rest of the first byte long, SDA is still outputting as normal), then
the clock transitions 8 times, there is the normal between byte pause, and
it clocks 9 times.  I will attach a drawing.

James


part 2 8765 bytes content-type:image/jpeg; name="I2Cscl.JPG" (decode)


part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)

2006\07\14@194542 by Bob Axtell

face picon face
Marty Robertson wrote:
{Quote hidden}

1K resistors? That seems low, to me. I seem to recall the I2C spec being
3.3K resistors...

--Bob

2006\07\14@223627 by Marty Robertson

picon face
I've seen others use anywhere from 1 to 10K, but I'm not sure on the spec.
I'll try something a little higher and see if that helps.

Thanks


On 7/14/06, Bob Axtell <spam_OUTengineerTakeThisOuTspamcotse.net> wrote:
{Quote hidden}

> -

2006\07\15@103201 by olin piclist

face picon face
Bob Axtell wrote:
> 1K resistors? That seems low, to me. I seem to recall the I2C spec
> being 3.3K resistors...

Actually IIC specifies the maximum logic low sink current, which means you
can use around 2Kohms to 5V if I remember right.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2006\07\15@103903 by olin piclist

face picon face
Marty Robertson wrote:
> I've seen others use anywhere from 1 to 10K, but I'm not sure on the
> spec.

Then get sure.

> I'll try something a little higher and see if that helps.

Try waving a dead fish over it during a full moon.

******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2006\07\15@110620 by Dave Wheeler

flavicon
face
Olin Lathrop wrote:
> Marty Robertson wrote:
>  
>> I've seen others use anywhere from 1 to 10K, but I'm not sure on the
>> spec.
>>    
>
> Then get sure.
>
>  
>> I'll try something a little higher and see if that helps.
>>    
>
> Try waving a dead fish over it during a full moon.
>  
Now do I go for the BIG fish or a little one ???? :-)
> ******************************************************************
> Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
> consultant in 2004 program year.  http://www.embedinc.com/products
>  

2006\07\15@113445 by Marty Robertson

picon face
What kind of fish?  Trout didn't work.

On 7/15/06, Olin Lathrop <.....olin_piclistKILLspamspam@spam@embedinc.com> wrote:
>
> Marty Robertson wrote:
> > I've seen others use anywhere from 1 to 10K, but I'm not sure on the
> > spec.
>
> Then get sure.
>
> > I'll try something a little higher and see if that helps.
>
> Try waving a dead fish over it during a full moon.
>
> ******************************************************************
> Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
> consultant in 2004 program year.  http://www.embedinc.com/products
> -

2006\07\15@114847 by Tamas Rudnai

face picon face
selfish, maybe :-)

On 15/07/06, Marty Robertson <suppergenusspamKILLspamgmail.com> wrote:
>
> What kind of fish?  Trout didn't work.
>
> On 7/15/06, Olin Lathrop <.....olin_piclistKILLspamspam.....embedinc.com> wrote:
> >
> > Marty Robertson wrote:
> > > I've seen others use anywhere from 1 to 10K, but I'm not sure on the
> > > spec.
> >
> > Then get sure.
> >
> > > I'll try something a little higher and see if that helps.
> >
> > Try waving a dead fish over it during a full moon.
> >
> > ******************************************************************
> > Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
> > consultant in 2004 program year.  http://www.embedinc.com/products
> > --

2006\07\15@115015 by Denny Esterline

picon face
I only have canned tuna here, will that work?

> What kind of fish?  Trout didn't work.
>
> On 7/15/06, Olin Lathrop <EraseMEolin_piclistspam_OUTspamTakeThisOuTembedinc.com> wrote:
> >
> > Marty Robertson wrote:
> > > I've seen others use anywhere from 1 to 10K, but I'm not sure on the
> > > spec.
> >
> > Then get sure.
> >
> > > I'll try something a little higher and see if that helps.
> >
> > Try waving a dead fish over it during a full moon.
> >
> > ******************************************************************
> > Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
> > consultant in 2004 program year.  http://www.embedinc.com/products
> > --

2006\07\15@115533 by Marty Robertson

picon face
Hello Bob,

  Thanks for the notes.  I'll give 1, 2 and 3 a shot.  I normally don't do
the hardware but in this case it fell to me. There are plenty of subtle
issues (ie, fish and moon phase) that I'm not aware of until I ask a more
cognizant crowd.  I'll report back when I try this on Monday.

Thanks



On 7/15/06, Bob Axtell < engineerspamspam_OUTcotse.net > wrote:

{Quote hidden}

2006\07\15@120055 by Marty Robertson

picon face
I'm seeing that the pull up's value depends on the bus capacitance and
supply voltage.  Supply voltage is 2.8V, but bus capacitance is probably on
the high side.  The board had layout errors and the signals are running
through jumper wires.  I'll measure it and then get sure.

Thanks


On 7/15/06, Olin Lathrop <KILLspamolin_piclistKILLspamspamembedinc.com> wrote:
{Quote hidden}

> -

2006\07\15@120218 by Marty Robertson

picon face
Albacore?

On 7/15/06, Denny Esterline <RemoveMEfirmwareTakeThisOuTspamtds.net> wrote:
{Quote hidden}

>

2006\07\15@125436 by olin piclist

face picon face
Marty Robertson wrote:
> I'm seeing that the pull up's value depends on the bus capacitance and
> supply voltage.

The minimum pullup value has nothing to do with capacitance, only supply
voltage.  Capacitance dictates how fast you can do.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2006\07\17@211512 by Marty Robertson

picon face
Hello Everyone,

    I'm back again.  Putting the Stop Start Stop sequence in my
initialization seems to have fixed the inconsistent start up problem but
something new has cropped up.

    By the way, sorry for putting you all through this.  In my small
company there was a firmware engineer and an electrical engineer.  The EE
who I would normally work with to resolve this kind of thing has moved to
(presumably) greener pastures leaving me in a little deep.

     The new problem I'm seeing is that the signal looks just great when my
I2C part is not on the bus (a slave-only AD5602 DAC).  When the device is on
the bus, during the address byte SDA looks proper and acknowledges that it
received the proper address.  However, the 9th clock bit is only about half
the voltage it should be and a giant impulse follows right on its heels.
Both SCL and SDA ring, then SCL starts the next byte at the proper place but
only emits one clock before just staying low.  SDA is just sitting high at
this time.      This is in a loop and should be sending 3 bytes (one
packet), delay, and then the next packet continuously.  When this goes wrong
it only sends the first packet, what I described happens, and then it does
nothing else.

    I say this because if I send the wrong address then I get Nack'd as I
should and everything continues to look good and the infinite loop of 3 byte
packets with a delay continues on.  This makes me think that there is some
contention that is going on when the slave receives its address, although
SCL should be input only on the slave.

    Also, if I put a 500 ohm series resistance between the DAC and SCL I
still have a crappy looking signal, but it doesn't hang after the first byte
and the DAC reads even that ugly signal just fine.

    Sorry for the narrative, any input is appreciated.

Thanks,

Mart

2006\07\18@033743 by Alan B. Pearce

face picon face
>The new problem I'm seeing is that the signal looks just
>great when my I2C part is not on the bus (a slave-only
>AD5602 DAC).  When the device is on the bus, during the
>address byte SDA looks proper and acknowledges that it
>received the proper address.  However, the 9th clock bit
>is only about half the voltage it should be and a giant
>impulse follows right on its heels. Both SCL and SDA ring,
>then SCL starts the next byte at the proper place but only
>emits one clock before just staying low.  SDA is just
>sitting high at this time. This is in a loop and should be
>sending 3 bytes (one packet), delay, and then the next
>packet continuously.  When this goes wrong it only sends the
>first packet, what I described happens, and then it does
>nothing else.

Are you using a software I2C or hardware? I ask because this sounds like it
could be software generated.

The step where you mention the 9th bit is half voltage sounds like you are
driving the SCL line hard high with the output instead of tri-stating it,
and the other device is attempting to clockstretch to delay the response by
pulling SCL low - as allowed in the I2C specification. You must not use an
output to drive either the SCL or SDA line high, but rather use the TRIS
bits to tri-state them and allow the resistor to pull the line high.

If you do not already have it, get the Philips I2C spec document from
http://www.standardics.philips.com/support/i2c/ (about half way down the
page). This is the bible on how to do things with I2C.


2006\07\18@155218 by Barry Gershenfeld

face picon face

> > However, the 9th clock bit
> >is only about half the voltage it should be and a giant
> >impulse follows right on its heels. Both SCL and SDA ring,

>The step where you mention the 9th bit is half voltage sounds like you are
>driving the SCL line hard high with the output instead of tri-stating it,

That's an important point, seeing as how you've lost the use of your EE.  It
is easy to make a mistake and set the SDA line to an output when you
shouldn't.

Giant pulses and ringing cause me to ask if you have long wires connecting
these two chips.   Or maybe a ground is missing?

> >     Also, if I put a 500 ohm series resistance between the DAC and SCL
> I still have a crappy looking signal, but it doesn't hang after the first
> byte and the DAC reads even that ugly signal just fine.

You can put a resistor between the two SDA lines as well.  And then use
your scope to find out which end of the resistor is at a lower
voltage.  That'll be the guy pulling the line down.  Use the same trick if
there is a "fight" over SCL.

Barry

More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...