Yahoo Groups archive

Lpc2000

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

Thread

I2C problem

I2C problem

2005-06-12 by Boris Kralik

Hi guys.
I have problem with I2C on LPC2294;
I set SDA and SCL wires as I2C:
	PCB_PINSEL0	|=	0x50;		//Set SCL and SDA
	PCB_PINSEL0	&= (uint32_t)0xFFFFFF5F;
and next configure I2C
	I2C_I2SCLL	=	60;
	I2C_I2SCLH	=	70;	
	I2C_I2CONSET	=	0x40;//	(1 << I2C_FLAG_I2EN);Enable I2C state after reset
 SDA is H, SCL is H <- OK

problem:
 when I send start bit
        I2C_I2CONSET	|=	(1 << 5);
 SDA go L (it is good), but SCL go L too <- it is wrong, isn't it ?

I think, SDA state must go to L and SCL continue in H state while I
start sending data or address. isn't it ? : IT IS MY QUESTIONS
         
This code is simply, where may be problem ?
Thank your for any ideas.

btw:I uses GNU compiler.
    when I off I2C bus by code:
 	I2C_I2CONCLR	|=	I2C_FLAG_I2EN;	//I2C off
        both signals goes to H        : it is OK
    when I send stop bit by code
        both signals goes to H        : it is OK

I2C problem

2006-03-09 by Sutton Mehaffey

I'm still having a bit of trouble getting correct status from LPC2148
interfacing with a Serial RAM chip.  And, I don't know why.  This is
supposed to be pretty straight forward.  I don't know why I'm having
trouble here.  I know that different chips require slightly different
packets.  Here's my short code and results.  Any clues?

Disregarding the setup of PCONP and other registers:


I2C0CONSET = 0x20;     // start command

// I2C0STAT now reads 0x08 - so we started I2C

// RAM chip ID is 1010000x with the last three 0s being device select
// Read (1) or Write (0) is the last bit - RAM_WRITE_ADDR = 0xA0

I2C0DAT = RAM_WRITE_ADDR;   // write Slave ID and Write bit (0xA0)
I2C0CONSET = 0x04;	    // Set AA bit for ACK
I2C0CONCLR = 0x18;          // clear STA and SI bits

// I2C0STAT now reads 0x18 - so device responded

// I want to read data from an arbitrary address 0x5555
// Datasheet says to send MSB then LSB

I2C0DAT = 0x55;         // MSB of address to read from
I2C0CONSET = 0x04;	// Set AA bit for ACK
I2C0CONCLR = 0x08;      // clear SI bit

// I2C0STAT now reads 0x08

Shouldn't this status read 0x28 so I can send LSB?  Is it aborting and
giving me a START status again?  If so, what's the reason?

Sutton

Re: [lpc2000] I2C problem

2006-03-09 by Aalt Lokhorst

Hello Sutton,

I see this line in your code

I2C0CONCLR = 0x18;          // clear STA and SI bits

I am using the LPC2129 so probably it is different, but
are you sure you are clearing the STA bit?
I think the 0x18 is wrong and should be 0x28.


Success,

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

Re: I2C problem

2006-03-09 by Sutton Mehaffey

Aalt,

That was it.  Now I get 0x28.  I guess I spent too long (way too long)
looking at the data sending process and not looking at making sure
those bits were set correctly.  Geez.

Sutton


--- In lpc2000@yahoogroups.com, "Aalt Lokhorst" <lokhorst@...> wrote:
Show quoted textHide quoted text
>
> Hello Sutton,
> 
> I see this line in your code
> 
> I2C0CONCLR = 0x18;          // clear STA and SI bits
> 
> I am using the LPC2129 so probably it is different, but
> are you sure you are clearing the STA bit?
> I think the 0x18 is wrong and should be 0x28.
> 
> 
> Success,
> 
> -- 
> ==============================
> 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@...
> ==============================
>

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.