View Single Post
  #11   Spotlight this post!  
Unread 03-05-2009, 14:33
timmmoore timmmoore is offline
Registered User
FRC #1899
 
Join Date: Mar 2008
Location: Bellevue
Posts: 18
timmmoore is on a distinguished road
Re: anyone else use the I2C bus?

Steve, I have tried 1 and 2 byte reads on CMPS03 without problem with SRF08 running at the same time.
I also found a way to cause the I2C bus to hang with both devices being accessed at the same time.
Difference
hang: 2 parallel while loops, 1 accessing CMPS03, 1 accessing SRF08
no hang: 1 while loop, accessing SRF08 then CMPS using a sequence

If you remove 1 or the other device physically from the bus but leave the code running both 'work'. But with both connected it may hang - it normally works for a while then hangs the while loop - I would expect this unless the I2C FPGA code has locking behavor for multiple accesses, you would end up with multiple conflicting bus accesses.

So you probably want to put all I2C accesses in 1 thread, store the results in local/global variables and access the variables when needed.