I am trying to talk to 2 I2C devices on the same I2C bus, one is a TMP102 temperature sensor on address 0x48 and the other is a STM8S set up as an I2C slave with address 0x50.
I know that I can talk to both of these independently but what I'm looking to do is to try and have the two devices on the same bus but I am getting an error.
My code looks like this:
using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using System.Threading; namespace I2CMaster { public class Program { public static void Main() { I2CDevice i2cBus = new I2CDevice(new I2CDevice.Configuration(0x50, 50)); I2CDevice tmp102 = new I2CDevice(new I2CDevice.Configuration(0x48, 50)); } } }
The second statement generates an exception:
An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dll
What I do not know is if this is expected behaviour, i.e. am I supposed to setup one I2C device, do some stuff with it and then release the I2C device before moving on to the second one.
Anyone out there reading from two I2C slaves on the same bus with NETMF ?
Regards,
Mark