IIC problem
tholberton
Posts: 41
I've been trying to get this camera working, but I'm having problems addressing it with iic. The device address is 01111000 (if beginning a write command). I don't think I'm receiving an acknowledgement bit. I'm trying to set it up so that it will turn on an LED when the acknowledgement bit is received. So far I've had very little luck. The device is the TCM8230MD. I've also checked the output in GEAR, everything looks fine from the logic probe.
DAT org 0 camera_control :counter_control or dira,extclk or dira,finpin movs ctra,#$10 movi ctra,#%0_00100_000 movi frqa,#%00100000_0 :start_cnd mov time,cnt add time,wait 'wait for the device to receive enough extclk signals waitcnt time,delay or dira,sdapin waitcnt time,delay or dira,clkpin waitcnt time,delay mov sda_space,data mov eight,#$0008 :iic_loop shr sda_space,#1 wc 'OUTPUT=LOW;INPUT=HIGH muxnc dira,sdapin waitcnt time,delay xor dira,clkpin waitcnt time,delay xor dira,clkpin waitcnt time,delay djnz eight,#:iic_loop wz :receive muxnz dira,sdapin xor dira,clkpin waitpne sdapin,sdapin xor dira,clkpin :doneloop or outa,finpin jmp #:doneloop three long $0000_0003 'number of bytes to send extclk long $0001_0000 'clock for camera clkpin long $0004_0000 sdapin long $0002_0000 ' finpin long $0000_8000 'finished {addresses, data, and vars } slave_address_read long $0000_0079 'for TCM8230MD slave_address_write long $0000_0078 'for TCM8230MD data long $0044_031E 'initialize subQCIF - 16 bits - 0000_0011 <- address 1010_0010 <- command delay long $0000_00FF 'sets the speed of the iic protocal at around 100_000hz. The maximum speed is 400_000 wait long $0000_FFFF eight res 1 sda_space res 1 time res 1 fit
Comments
1 - is the SCL clock rate running at the appropriate speed for the camera device?
2 - are the SCL and SDA lines pulled high to +5V through resistors (10k)?
3 - is the I2C Start condition being created correctly?
4 - do you have a scope to view the SDA line?
I'm not familiar with the Prop, but a bit familiar with I2C.
the sda and sck lines are pulled high with 2.8V because that's the requirement of the camera. yes, I'm using 10K resistors
yes
no, but I wish I did and I'm considering getting a oscilloscope or logic probe for that general use
I'm starting to think that running 2.8V straight into the RES (active low) might be messing it up, cause I'm not sure if there's any input impedance or not
-Phil
edit - it's been using 1E the whole time. i forgot because I wrote this code a few weeks ago.
Can you control the clocking to the camera such that you would be able to stop it at the 9th cycle? This would allow you to check/measure the level of the SDA line, which should be a "low" (ACK/).
edit - thanks though for the suggestion. the datasheet has a power on sequence that I've only loosely followed,
I'm going to change the power on sequence and see if that helps.