Yahoo Groups archive

Lpc2000

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

Message

Re: LPC2214 I2C master problems

2005-05-24 by Remis Norvilis

Thanks again. I am clearing the STA flag (and I see that the SIC is 
also cleared simultaneously). I also checked my PINSEL0 register 
setting and it should be the same as the LPC2129 for selecting I2C 
bus (pins 50 & 58 on the LPC2214). I'm starting to wonder if this 
problem is a peculiarity to the LPC2214 (but I haven't seen anything 
specifically to I2C in an Eryata (yet))...

--- In lpc2000@yahoogroups.com, Karsten Weiß <kweiss@i...> wrote:
> Okay. Low on both lines means, that the I2C bus is busy at the 
moment, 
> which is definitively correct, if you outputted a start condition. 
After 
> your start condition was outputted and the corresponding interrupt 
> occured, you have to reset the STA flag by writing 0x20 to I2CONCLR 
and 
> then writing the slave addr to I2DAT. Now, reset the interrupt flag 
(by 
> writing 0x08 to I2CONCLR). This should work. I'm using this on  an 
> LPC2129, but without any interrupt service (just waiting for a 
change in 
> the I2STAT reg.).
> 
> Regards,
> Karsten Weiß
> 
> Remis Norvilis schrieb:
> 
> > Thank you for your prompt response Karsten! Unfortunately, I 
believe
> > that I'm setting the I2C clock rate appropriately (PCLK = 3.6864 
MHz,
> > desired I2C clock rate = 97 KHz. Therefore, I've set I2SCLH and
> > I2SCLL each with a value of 19 (0x13). I believe this is correct
(?)
> >
> > --- In lpc2000@yahoogroups.com, Karsten Weiß <kweiss@i...> wrote:
> > > Propably, you have not set the baudrate for the I2C module. This
> > can be
> > > done using the I2SCLL and I2SCLH registers.
> > > A possible initialization if the I2C module kis the following:
> > (F_VPB is
> > > the Peripheric bus clock speed in Hz and baudrate is also 
measured
> > in Hz).
> > >
> > > void i2c_init( unsigned long baudrate )
> > > {
> > >     unsigned int divider = F_VPB / baudrate;    // calculate the
> > clock
> > > divider
> > >     // Initialize Pin Connect Block:
> > >     PINSEL0 |= 0x50;                        // P0.2 and P0.3 as 
I2C
> > > pins! (This has propably to be changed according to the pinning 
of
> > your
> > > chip)
> > >
> > >     // Initialize I2C:
> > >     I2C_I2CONCLR = 0x6c;                    // clearing all 
flags
> > >     I2C_I2CONSET = I2C_FLAG_I2EN;           // enabling I2C
> > >     I2C_I2SCLL = divider / 2;              // I2CSCLL + I2CSCLH 
has
> > to
> > > be equal to that divider!
> > >     I2C_I2SCLH = divider - I2C_I2SCLL;
> > > }
> > >
> > > hoping this helps,
> > >
> > > Karsten Weiß
> > >
> > > Remis Norvilis schrieb:
> > >
> > > > I'm having difficulty with getting the I2C to work (with the
> > LPC2214 as
> > > > the master). I can get as far a valid start condition (0x08) 
and
> > > > generate an interrupt, but I can't get the clock line (SCL) to
> > > > oscillate. If I debug, it appears that both the clock (SCL) 
and
> > the
> > > > data line (SDA) go low simultaneously after start flag is set
> > (STA in
> > > > the I2CONSET register).
> > > > After the interrupt is generated, I attempt to send an 
address,
> > (by
> > > > setting the contents of the I2DAT to a valid PCF8574 slave
> > address 7-
> > > > bit value + a "0" for a "write" (ex. "0x40")). Both the SCL 
and
> > SDA
> > > > lines appear to remain low until the start flag &/OR the
> > Interrupt flag
> > > > is cleared (by setting either the STAC &/OR the SIC bits in 
the
> > > > I2CONCLR register). I've also tried to set the address value 
in
> > the
> > > > I2DAT register after clearing the start &/OR interrupt flags 
with
> > the
> > > > same result.
> > > >
> > > > Note: I do have 10K ohm pull-up resistors (to 5v) on both the 
SDA
> > and
> > > > SCL lines.
> > > >
> > > >
> > > >
> > > > --------------------------------------------------------------
----
> > ------
> > > > *Yahoo! Groups Links*
> > > >
> > > >     * To visit your group on the web, go to:
> > > >       http://groups.yahoo.com/group/lpc2000/
> > > >       
> > > >     * To unsubscribe from this group, send an email to:
> > > >       lpc2000-unsubscribe@...m
> > > >       <mailto:lpc2000-unsubscribe@yahoogroups.com?
> > subject=Unsubscribe>
> > > >       
> > > >     * Your use of Yahoo! Groups is subject to the Yahoo! 
Terms of
> > > >       Service <http://docs.yahoo.com/info/terms/>.
> > > >
> > > >
> > >
> >
> >
> >
> > ------------------------------------------------------------------
------
> > *Yahoo! Groups Links*
> >
> >     * To visit your group on the web, go to:
> >       http://groups.yahoo.com/group/lpc2000/
> >        
> >     * To unsubscribe from this group, send an email to:
> >       lpc2000-unsubscribe@yahoogroups.com
> >       <mailto:lpc2000-unsubscribe@yahoogroups.com?
subject=Unsubscribe>
> >        
> >     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >       Service <http://docs.yahoo.com/info/terms/>.
> >
> >

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.