EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

I2C loading the I2DAT w/out a vectored interrupt

Started by i will tell u if u ask June 16, 2006
Hi
I have a general question for those of you who have used the I2C
hardware on the LPC21XX. I am using a LPC2104 and I am trying to send
some I2C data with my LPC2104 set as the master in transmit mode,
without having to use the SI bit to vector an interrupt service to
load the I2DAT register. In other words i want to load the I2DAT after
the SI bit in I2CONSET, and not having to load it in an ISR. Can i do
this?

I2CONSET = 0x40; //enable I2C periphrial
I2CONSET = 0x60; //send a start condition
I2DAT = 0xC; //load data register to-
//-wirte a 6 to the slave

I2CONCLR = 0x08; //clear interrupt flag
I2CONSET = 0x10; //send a stop conditon
I2CONCLR = 0xFF; //Clear the bits

When i Run the software in Debug mode the SI bit is set after I send
an Start condition on the I2C line.

Thanks
Sam

An Engineer's Guide to the LPC2100 Series

Note:
I can get it to work in debug mode with the j-link but not with free run.

Sam,

I have gotten my I2C to work with a LPC2148 without vectoring by just
looking at the SI bit. I've gotten to work both a RAM and a RTC.

In your code, first of all, a START is a 0x20 as you have already
enabled I2C by your previous statement. Next, after your START, you
must poll the SI bit before proceeding to do anything else. You need
a state routine for doing the reads/writes based on the status you
receive from the I20STAT register each time the SI bit is set.

You can contact me offline at 's...@hi-s.com' if you want.

Sutton


The 2024 Embedded Online Conference