Raptor + CP7 : Failed to perform I2C transaction errors

I have just received a new Raptor and CP7 today :slight_smile:

Whilst testing touch events I get frequent “Failed to perform I2C transaction” errors occurring in the Output log.

I see that there are a couple of similar threads in regards to this issue with Glide, but I am not using Glide and there doesn’t seem to be a definitive answer.

Most basic code that can induce the fault.

       void ProgramStarted()

            Debug.Print("Program Started");

            display_CP7.ScreenPressed += new Display_CP7.TouchEventHandler(display_CP7_ScreenPressed);

        private void display_CP7_ScreenPressed(Display_CP7 sender, Display_CP7.TouchStatus touchStatus)
            Debug.Print("Screen Pressed Event Triggered");

When using this code, the Output log mainly shows with the Screen pressed event message but will get the occasional Failed to perform I2C transaction message. As a curiosity a single touch will generate multiple Screen Pressed output messages.

If I use the Poker or CP7 Touch Manager examples contained in codeshare then the Output log shows lots of Failure messages and many touches appear not to be recognised.

I have tried different Gadgeteer cables and ports on the Raptor with the same result. Cables on the rear of the CP7 look to be well seated and are not loose at all.

If I connect the CP7 to a Cobra II and run the same tests then I do not seem to have the issue - the Poker example works well and no errors are generated.

Firmware is on both the Cobra and Raptor and I am using 2013 R3 SDK with VS2010 on Windows 7 64 and a powered USB hub.



Have a look at this thread:

Hi Reinhard,

Thanks for responding.

I had already had a read of that thread. One of the things that appeared to help in that case was to use a different port for the touch interface but this did not seem to make any difference for me.

I have tried sockets 4 and 14 on the Raptor and different cables, but get the same result - will work some of the time and not others.



We are able to reproduce the issue and it is already fixed for the next SDK. I2C is sometimes corrupted on the G400, so since CP7 touch uses I2C, it is sometimes affected as well.

Thanks for the info John.

Will wait for the update.



Does this mean that I2C does not currently 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);

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


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.

When might this new SDK be available? How about a quick hotfix … Right
now my CP7 display is of no use until I can get the Touch screen to work.


Any update on the new SDK? I also have a Raptor and a CP7 and can not do much since touch is not working.

Thank You


It should be out very soon.

Did anyone have any luck with the new firmware fixing this issue? I am still getting the issue after upgrading the firmware. Any ideas?

I’ll be updating tonight when I get home to check if a few issues are now corrected. This one is top on my list to check.


Ok… Installed the update, updated the firmware, recompiled and redeployed …

Still broken. Same errors as before… CP7 touch is completely useless on the Raptor.


OK thanks. At least now I know it is not just me having the problem.

Are you able to get any proper touch events at all?

It is expected behavior to receive multiple screen pressed events at once. The Raptor is so quick that even a quick press can return multiple press events. That is by design so that dragging actions work properly. If you only want one touch event per point, though, you can implement a filtering solution.

Yes I am able to get the touch events but still get the I2C transaction errors also. The touch events also seem to freeze at times. I will play around with it some more tonight with just the simple code from the first message and see what happens.


I also get invalid touch events. For example, for an X,Y point I could get


And I still get the I2C messages as well.


How often are you getting the messages?

Could it be that this is power related issue?

I’ll try to get a debug log of the output and post it. Its actually quite a lot of events being generated.