Shop OBEX P1 Docs P2 Docs Learn Events
Need help with Propeller as an I2C slave using spin — Parallax Forums

Need help with Propeller as an I2C slave using spin

Mike GMike G Posts: 2,702
edited 2010-06-17 13:20 in Propeller 1
I’m trying to get the Propeller to act as a I2C slave device using spin. I’ve been racking my brain on this for a while now. I tried several approaches starting with looping and conditions that monitor the INA register. Then I moved on to using WAITPEQ (State, Mask, Port ) to detect the start of data transfer; SDA going low while SCL is high.
  WAITPEQ(%11, %11, 0) ' SCL = high SDA = high (Bus not busy)
  WAITPEQ(%10, %11, 0) ' SCL = high SDA = low (Start) 



WAITPEQ is not an ideal solution because I need a timeout. I’m just trying to get anything working.

My setup is a BS2p executing the following loop.
Main:
  I2COUT 0, $A0, %0001, [noparse][[/noparse]%0010, %0011]
  PAUSE 100
  GOTO Main



I’m using 1k inline resistors going to the Propeller and 4.7K pull-ups to Vcc.

I attached the scope output. It’s kinda’ strange to me that the scope output shows 0xA0 seven times then %0001, [noparse][[/noparse]%0010, %0011]. I’m expecting one 0xA0. Thought it might have something to do with the ACK bit. I can’t seem to hit ACK on the 9th clock pulse.

How can I sense a start condition “high-to-low transition of the SDA line while the clock (SCL) is high” using SPIN? I think if I can get that working I should be able to figure out the rest. Should I be using PASM?
1016 x 235 - 66K

Comments

Sign In or Register to comment.