I try to communicate between a raspberry pi 3 running windows 10 IOT build 14376 insiders and a T-REX Manual here using I2C protocol. The thing is that it always crash, so after some debug process I've found that it looks like it doesn't retrieve anything from the DeviceInformation.FinAllAsync(..)
and that cause after an ArgumentOutOfRangeException
. It should have some thing I don't understand, maybe in the device capabilities or permissions, which Microsoft tutorial doesn't mention here
var settings = new I2cConnectionSettings(0x07);
settings.BusSpeed = I2cBusSpeed.StandardMode;
var aqs = I2cDevice.GetDeviceSelector("I2C1");
var dis = await DeviceInformation.FindAllAsync(aqs);
int a = dis.Count; //is always equal to 0
Then I have a using (I2cDevice device = await I2cDevice.FromIdAsync(dis[0].Id, settings)){...}
which fails with the ArgumentOutOfRangeException
mentionned before
A second way I tried was using this code:
I2CDevice device;
var settings = new I2cConnectionSettings(0x07);
settings.BusSpeed = I2cBusSpeed.StandardMode;
var controller = await Windows.Devices.I2c.I2cController.GetDefaultAsync();
device = controller.GetDevice(settings);
which produce a NullReferenceException
with the last line