Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: initializing I2C problem

2005-04-15 by jim_e_dallas

Some erroneous I2C data on the bus can cause this condition. If an 
I2C node sends a start condition with out a valid stop, then the I2C 
interface will think the bus is busy and never generate the start 
condition. When I write an I2C interface, I generally use a "switch
(I2CSTAT)" with a case for each of the possible I2CSTAT states. Then 
I add a bus free timeout counter and a message length timeout 
counter. The Bus free timeout is for the condition mentioned above 
and starts a timer when the start condition is requested and is reset 
when the start condition has been transmitted. If too long a time 
goes by without a start condition being sent, then the timeout would 
reset the I2C interface so it no longer thinks the bus is busy. The 
message length timeout also helps recover from the condition where a 
master does not send out enough SCL clocks to complete a slave 
transmission. If the slave send out a '0' and no more clocks are 
received a "stuck bus" can occur. A message length timeout is started 
when a start condition is received and reset when a stop condition is 
received. If the stop condition is not received, the the I2C 
interface is reset after a period of time and releases the bus from 
it's "stuck" condition. These timeouts may vary depending on the 
application.

Regards,

Jim E.

--- In lpc2000@yahoogroups.com, "semetex01" <info.semetex@s...> wrote:
> 
> --- In lpc2000@yahoogroups.com, "neptunus1000" <roykrikke@h...> 
wrote:
> > 
> > Hello everybody,
> > 
> > is there realy nobody how had ths problem before. Or is there 
realy 
> > nobody how now's a solution.
> > 
> > Thanks Roy
> > 
> > --- In lpc2000@yahoogroups.com, "neptunus1000" <roykrikke@h...>
> wrote:
> > > 
> > > Hello,
> > > 
> > > "Was there indeed a pull-up resistor missing on the Olimex
> board?" 
> > > YES there was one missing.
> > > 
> > > I put for the testing two pull-up on the bus of 4,7K and
> connected 
> > to 
> > > the 3.3 Volt. When I'm debugging the program. The program is
> still 
> > > hanging on the while(I2STAT != 0x08);. When I measure the both
> I2C 
> > > lines with pull-up, the lines have 3.3 Volt. The program is not 
> > > working. If I disconnect the pull-up resistor the SDA line is 
3.3 
> > > Volt and the SCL line is 0 Volt. This is oke if I look in the 
> > schema 
> > > of the Olimex board. I really don't understand why it is not 
> > working.
> > > 
> > > Of course I can build some code for 'bit-bang', but if the uC 
has
> a 
> > > I2C bus. Then it is ugly to build a 'bit-bang' routine.
> > > 
> > > I measured with a FLUKE 123 scope meter.
> > > 
> > > Best Regards
> > > Roy
> > > 
> > > --- In lpc2000@yahoogroups.com, "Aalt Lokhorst" <lokhorst@s...> 
> > wrote:
> > > > Hello Roy,
> > > > 
> > > > Was there indeed a pull-up resistor missing on the Olimex 
board?
> > > > 
> > > > If you can measure low and high levels on both I2C lines now
> then 
> > I 
> > > > expect that the hardware is fine. If there is also a I2C 
device 
> > on 
> > > the 
> > > > bus and it is still not working then i assume it is a 
software 
> > > problem.
> > > > 
> > > > In the past I used I2C on a 8051 with some 'bit-bang' 
routines. 
> > > Until 
> > > > now I didn't use the I2C of the ARM. This will change in the
> next 
> > > few 
> > > > weeks but for the moment I can't help you.
> > > > 
> > > > In the files section of the yahoo group are some examples. If
> the 
> > > > pull-up indeed was missing in the hardware then you probably 
> > spend 
> > > a lot 
> > > >   of time with software debugging without any change to 
succeed.
> > > > Might be the moment to start debugging again, use an
> oscilloscope 
> > > if you 
> > > > have it and study the signals to see where it fails.
> > > > 
> > > > Best Regards
> > > > Aalt,
> > > > 
> > > > 
> > > > -- 
> > > > ==============================
> > > > Aalt Lokhorst
> > > > Schut Geometrische Meettechniek bv
> > > > Duinkerkenstraat 21
> > > > 9723 BN Groningen
> > > > P.O. Box 5225
> > > > 9700 GE Groningen
> > > > The Netherlands
> > > > Tel: +31-50-5877877
> > > > Fax: +31-50-5877899
> > > > E-mail: Lokhorst@S...
> > > > ==============================
> > > > 
> > > > 
> > > > neptunus1000 wrote:
> > > > > 
> > > > > Hello Aalt,
> > > > > 
> > > > > with on both lines a pull-up the code is still not working
> oke.
> > > > > Please help my.
> > > > > 
> > > > > --- In lpc2000@yahoogroups.com, "Aalt Lokhorst"
> <lokhorst@s...> 
> > > wrote:
> > > > >  > Hello Roy,
> > > > >  >
> > > > >  > Is there a pull-up on the SCL line? I can't find it in 
the
> > > > > schematic
> > > > >  > drawing but probably I missed it.
> > > > >  >
> > > > >  > As far as I know both lines need a pull-up because SDA 
and 
> > SCL
> > > > > lines are
> > > > >  > 'open-drain' outputs.
> > > > >  >
> > > > >  > Best Regards,
> > > > >  > Aalt
> > > > >  >
> > > > >  > --
> > > > >  > ==============================
> > > > >  > Aalt Lokhorst
> > > > >  > Schut Geometrische Meettechniek bv
> > > > >  > Duinkerkenstraat 21
> > > > >  > 9723 BN Groningen
> > > > >  > P.O. Box 5225
> > > > >  > 9700 GE Groningen
> > > > >  > The Netherlands
> > > > >  > Tel: +31-50-5877877
> > > > >  > Fax: +31-50-5877899
> > > > >  > E-mail: Lokhorst@S...
> > > > >  > ==============================
> 
> Roy,
> 
> I had this problem (I2C start not generated and I2C status at 0xf8
> forever) on an Olimex board (LPC-WEB 2124) and a pull-up on SCL 
fixed
> it.
> 
> H.A.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.