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

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@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/>.
> >
> >
> 
> -- 
> ------------------------------------------------------------------
> Dipl.-Ing. Karsten Weiß
> 
> Universität Karlsruhe (TH)
> Institut für Prozeßrechentechnik, Automation und Robotik (IPR)
> Geb. 40.28
> Kaiserstraße 12
> D-76128 Karlsruhe
> 
> Tel.: (0721) 608 - 7124
> Fax: (0721) 608 - 7141
> ------------------------------------------------------------------

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.