Yahoo Groups archive

Lpc2000

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

Message

need i2c help please

2005-05-23 by b clapper

Hi Everyone,

I'm having a problem with an i2c interface between LPC2138
and an image sensor. I'm using i2c to set parameters in
the image sensor, like exposure, rgb gain, clocking etc. After
capturing a frame, I'm trying to use i2c to get information
back from the sensor about the relative brightness of the
frame. I hope to use this to adjust my exposure setting.

Anyway, I'm able to write the parameters to the image sensor 
without problems (I think) but I'm not having success reading.
I know I can set some parameters correctly because I can change
clocking, for example, and see it on the scope. Unfortunately,
I can only read a few parameters before I start seeing 
unrecognizable settings.

I hooked my board to the scope and trapped the waveforms
on the SCL and SDA lines while reading and here's what I see. (By
the way, I have a tektronix tds1002 - and I'm not sure if this is
adequate to 'catch' everything I need).

- successful start condition.
- successful send of slave_address + R bit
- ack by receiver (camera in this instance)

Then, I see a blip on the sda line. It goes from low to high and 
then pulled low again before the next SCL peak. I *think* this 
is ok, but not sure. I think this is the LPC releasing SDA after
his ack, and the camera taking control of it to start sending
data.

Anyway, next I see the data coming. 8 bits, 1 ack bit, then the
blip. This might happen for another byte or two and then I see
8 data bits, and ack bit and then no 'blip'.  At this point, the
SDA line goes high and stays high - until the lpc acks eight
high bits. All data from this point, of course, is 0xFF.  It
doesn't happen in the same place but it always happens.
Sometimes I read 3-4 bytes, other times 1 or 2. I'm trying to 
read 20.

It seems as if the camera has left the building and the LPC is 
talking to himself! The image sensor is still running (I can
measure his pxlclock, vsync, hsync, etc).

Anyway, I'm not sure if I've got a configuration problem or a
timing problem or what. I've tried slowing down the i2c clock
from 400khz to 100khz, I tried using different values for the
duty cycles (SCLH/SCLL - not sure what that does if anything).
I've made sure that I2CON_AA is set after each read to ensure
I get an ack. I do that for all reads except the last one.

Is it possible for the camera to see a stop condition and not the
LPC? 

Anyway does anyone have any ideas of what I might look for or try?
If not, do you know an i2c expert in Europe or the UK (the closer
to Zurich Switzerland better for me)?

Any pointers or consideration would be greatly appreciated.

thanks,
Bryan

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.