Forums

initializing I2C problem

Started by neptunus1000 April 12, 2005

Hello,

I use an olimex evaboard (LPC2129) and crossStudio.
I would like to use the I2C interface but it won't work.
ARM should be the master. First I tried to code it on my own with the
datasheet. Then I found some example code on the group.

The methode InitI2C() is working fine. Only the methode
SendSlaveAdress(unsigned char Addr_S) is working not well. At "while
(I2STAT != 0x08); // Wait for start to be completed" my code stops
and is waiting for de SI bit to set. This is never happening. I don't
understand why it is already stopping here.

I have nothing connected to the I2C bus, I mean that there is only
the EEPROM. Which is standard on the evaboard. I'm using 0xA0 address
for writing and 0xA1 for reading. But it can only by a matter if the
code can past this line of code "while(I2STAT != 0x08);"

For who have an interest this is the link the de pcb plan.

http://microcontrollershop.com/Images/lpc-e2124-sch.gif?
osCsid>8281154ae1883323bdf695bf87d276 can anybody help?
Roy

#define STA 0x20
#define SIC 0x08
#define SI 0x08
#define STO 0x10
#define STAC 0x20
#define AA 0x04

#include <__cross_studio_io.h>

class I2C{
private:

public:
I2C(void);
void delay(int);
void InitI2C(void);
void SendSlaveAdress(unsigned char);
unsigned char ReadOnI2C(void);
void WriteOnI2C(unsigned char);
void StopI2C(void);
};

I2C::I2C(void){

}
void I2C::delay(int d){
for(; d; --d){
asm volatile ("nop");
}
}

void I2C::InitI2C(void) {
I2CONCLR = 0xFF;
PINSEL0 |= 0x50; // Set pinouts as scl and sda
I2SCLL `; //19 speed at 100Khz for a VPB Clock Divider =
4 at 14 MHz
I2SCLH `;
// I2SCLL`; //speed at 375Khz for a VPB Clock Divider = 1
// I2SCLHp; // Pierre Seguin's origional values.
I2CONSET = 0x40; //Active Master Mode on I2C bus
}

void I2C::SendSlaveAdress(unsigned char Addr_S){
unsigned char r;
I2CONCLR = 0xFF; // clear I2C - included if User
forgot to "StopI2C()"
// else this function would hang.
I2CONSET = 0x40; // Active Master Mode on I2C bus
if((Addr_S & 0x01)) // test if it's reading
I2CONSET = STA | AA; // set STA - allow master to
acknowlege slave;
else
I2CONSET = STA; // set STA dont allow acknowledges;
r = I2STAT;
while(I2STAT != 0x08) ; // Wait for start to be completed
I2DAT = Addr_S; // Charge slave Address
I2CONCLR = SIC | STAC; // Clear i2c interrupt bit to send
the data
r = I2STAT;
while( ! ( I2CONSET & SI)) ; // wait till status available
r = I2STAT; // read Status. See standard error
codes pdf (link in manual).
if(!(Addr_S & 0x01)) { // if we are doing a write
if (r != 0x18) { // look for "SLA+W has been
transmitted; ACK has been received"
if ( r==0x20 ) // check for "SLA+W has been
transmitted; NOT ACK has been received"
debug_printf("no acknowlege - probably no device
there.\n"); // no acknowlege - probably no device there. Return a 1
in longjmp
debug_printf("error code: %x\n", r); // other
error - return status code in longjmp
}
} else {
if (r != 0x40) { // look for "SLA+R has been
transmitted; ACK has been received"
if ( r==0x48 ) // check for "SLA+R has been
transmitted; NOT ACK has been received"
debug_printf("no acknowlege - probably no device
there.\n"); // no acknowlege - probably no device there. Return a 1
in longjmp
debug_printf("error code: %x\n", r); // other
error - return status code in longjmp
}
}
debug_printf("I2STAT OK %x\n", r);
}

unsigned char I2C::ReadOnI2C(void) {
unsigned char r;
I2CONCLR = SIC; // clear SIC;
while( ! (I2CONSET & 0x8)); // wait till status available
r=I2STAT; // check for error
if (r != 0x50){ // look for "Data byte has been
received; ACK has been returned"
debug_printf("Read fail error code: %x\n", r); //
read fail
}
return I2DAT;
}

void I2C::WriteOnI2C(unsigned char Data) {
unsigned char r;
I2DAT = Data; // Charge Data
I2CONCLR = 0x8; // SIC; Clear i2c interrupt bit
to send the data
while( ! (I2CONSET & 0x8)); // wait till status available
r = I2STAT;
if (r != 0x28){ // look for "Data byte in S1DAT
has been transmitted; ACK has been received"
debug_printf("Write fail error code: %x\n", r); //
write fail
}
}

void I2C::StopI2C(void){
I2CONCLR = SIC;
I2CONSET = STO;
while((I2CONSET&STO)) ; // wait for Stopped bus I2C
}


An Engineer's Guide to the LPC2100 Series

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@Lokh...
==============================

neptunus1000 wrote:
>
> Hello,
>
> I use an olimex evaboard (LPC2129) and crossStudio.
> I would like to use the I2C interface but it won't work.
> ARM should be the master. First I tried to code it on my own with the
> datasheet. Then I found some example code on the group.
>
> The methode InitI2C() is working fine. Only the methode
> SendSlaveAdress(unsigned char Addr_S) is working not well. At "while
> (I2STAT != 0x08); // Wait for start to be completed" my code stops
> and is waiting for de SI bit to set. This is never happening. I don't
> understand why it is already stopping here.
>
> I have nothing connected to the I2C bus, I mean that there is only
> the EEPROM. Which is standard on the evaboard. I'm using 0xA0 address
> for writing and 0xA1 for reading. But it can only by a matter if the
> code can past this line of code "while(I2STAT != 0x08);"
>
> For who have an interest this is the link the de pcb plan.
>
> http://microcontrollershop.com/Images/lpc-e2124-sch.gif?
> osCsid>8281154ae1883323bdf695bf87d276




Hello Aalt,

with on both lines a pull-up the code is still not working oke.
Please help my.

--- In lpc2000@lpc2..., "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...
> ==============================
>
> neptunus1000 wrote:
> >
> > Hello,
> >
> > I use an olimex evaboard (LPC2129) and crossStudio.
> > I would like to use the I2C interface but it won't work.
> > ARM should be the master. First I tried to code it on my own with
the
> > datasheet. Then I found some example code on the group.
> >
> > The methode InitI2C() is working fine. Only the methode
> > SendSlaveAdress(unsigned char Addr_S) is working not well.
At "while
> > (I2STAT != 0x08); // Wait for start to be completed" my code stops
> > and is waiting for de SI bit to set. This is never happening. I
don't
> > understand why it is already stopping here.
> >
> > I have nothing connected to the I2C bus, I mean that there is only
> > the EEPROM. Which is standard on the evaboard. I'm using 0xA0
address
> > for writing and 0xA1 for reading. But it can only by a matter if
the
> > code can past this line of code "while(I2STAT != 0x08);"
> >
> > For who have an interest this is the link the de pcb plan.
> >
> > http://microcontrollershop.com/Images/lpc-e2124-sch.gif?
> > osCsid>8281154ae1883323bdf695bf87d276



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@Lokh...
============================== neptunus1000 wrote:
>
> Hello Aalt,
>
> with on both lines a pull-up the code is still not working oke.
> Please help my.
>
> --- In lpc2000@lpc2..., "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...
> > ==============================




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@lpc2..., "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@lpc2..., "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...
> > > ==============================




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@lpc2..., "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@lpc2..., "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@lpc2..., "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...
> > > > ==============================




Hi,

> At "while (I2STAT != 0x08); my code stops

...check what Status Code is in I2STAT (instead of 0x08), maybe this
gives you a hint to find the problem.

Description of i2c status byte can be found in table 3 to 6 in:
http://www.semiconductors.philips.com/acrobat/various/8XC552_562OVERVIE
W_2.pdf

Regards
Arvid



--- In lpc2000@lpc2..., "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@lpc2..., "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@lpc2..., "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@lpc2..., "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.




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@lpc2..., "semetex01" <info.semetex@s...> wrote:
>
> --- In lpc2000@lpc2..., "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@lpc2..., "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@lpc2..., "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@lpc2..., "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.




Hello,

can you tell some more about the I2C reset, how this works. If it is
possible that you can post you're code. I think some people on this
group will thank you.

Thanks

Roy

--- In lpc2000@lpc2..., "jim_e_dallas" <jim_e_dallas@y...>
wrote:
>
> 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@lpc2..., "semetex01" <info.semetex@s...>
wrote:
> >
> > --- In lpc2000@lpc2..., "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@lpc2..., "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@lpc2..., "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@lpc2..., "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.