Main Site Documentation

Raptor and I2C


#1

I’ve seen in another post that I2C may be corrupted in some Raptor Boards.
Does the hardware I2C work on any of the Raptor boards? Or is it just a subset?

I get the exception below when running these two lines:
I2CDevice.Configuration con = new I2CDevice.Configuration(0x51, 400);
I2CDevice MyI2C = new I2CDevice(con);

Does anyone have I2C working on a Raptor?
Should I switch to the Software I2C?

Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) #### Message: #### Microsoft.SPOT.Hardware.Port::ReservePin [IP: 0000]

#### Microsoft.SPOT.Hardware.I2CDevice::.ctor [IP: 0021]

#### GadgeteerApp1.Program::i2c [IP: 0010]

#### GadgeteerApp1.Program::ProgramStarted [IP: 000d]

A first chance exception of type ‘System.InvalidOperationException’ occurred in Microsoft.SPOT.Hardware.dll An unhandled exception of type

‘System.InvalidOperationException’ occurred in Microsoft.SPOT.Hardware.dll

Thanks!


#2

My reply from the other thread https://www.ghielectronics.com/community/forum/topic?id=14449&page=1#msg148089

I2C does otherwise work in most case in the current SDK. Based on the exception you posted, it looks like you are trying to use an I2C pin somewhere else in your program before you create the I2C device since it is failing inside the ReservePin function.