FEZ Cobra II + cp7 display - Failed perform I2C Transaction

Update with firmware v4.2.9.1 + 4.2.9.0 tinybooter

This is simple button Glide program that I try to run.

using System;
using System.Collections;
using System.Threading;
using System.IO;
using System.IO.Ports;
using Microsoft.SPOT;
using Microsoft.SPOT.Touch;

using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Networking;
using Gadgeteer.Modules.GHIElectronics;

using GHIElectronics.NETMF.Glide;
using GHIElectronics.NETMF.Glide.Display;
using GHIElectronics.NETMF.Glide.UI;


namespace GlideButtonDemo
{
    public partial class Program
    {
        static Window window;

        void ProgramStarted()
        {
            Mainboard.SetDebugLED(true);
            // Do one-time tasks here
            Debug.Print("Program Started");

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

            // Load the Window XML string.
            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window1));

            // Resize any loaded Window to the LCD's size.
            Glide.FitToScreen = true;

            // Assign the Window to MainWindow; rendering it to the LCD.
            Glide.MainWindow = window;

            // Get the Buttons
            Button buttonRed = (Button)window.GetChildByName("buttonRed");
            Button buttonGreen = (Button)window.GetChildByName("buttonGreen");
            Button buttonBlue = (Button)window.GetChildByName("buttonBlue");

            // Set up event handlers
            buttonRed.PressEvent += new OnPress(buttonRed_TapEvent);
            buttonGreen.PressEvent += new OnPress(buttonGreen_TapEvent);
            buttonBlue.PressEvent += new OnPress(buttonBlue_TapEvent);

        }

        void buttonBlue_TapEvent(object sender)
        {
            Mainboard.SetDebugLED(false);
            Debug.Print("yes1");//led.TurnBlue();
        }

        void buttonGreen_TapEvent(object sender)
        {
            Debug.Print("yes2");//led.TurnGreen();
        }

        void buttonRed_TapEvent(object sender)
        {
            Debug.Print("yes3");//led.TurnRed();
        }

        static int lastX = 0;
        static int lastY = 0;
        static int x;
        static int y;
        static bool isTouched = false;
        void display_CP7_ScreenPressed(Display_CP7 sender, Display_CP7.TouchStatus touchStatus)
        {
            GHIElectronics.NETMF.Glide.Geom.Point touches;
            if (touchStatus.numTouches > 0)
            {
                touches.X = touchStatus.touchPos[0].xPos;
                touches.Y = touchStatus.touchPos[0].yPos;
                x = 0;
                y = 0;
                if (isTouched == false)
                {
                    GlideTouch.RaiseTouchDownEvent(null, new TouchEventArgs(touches));
                    lastX = x;
                    lastY = y;
                    isTouched = true;
                }
                else
                {
                    if (lastX != touches.X && lastY != touches.Y)
                    {
                        touches.X = lastX;
                        touches.Y = lastY;
                        GlideTouch.RaiseTouchUpEvent(null, new TouchEventArgs(touches));
                        isTouched = false;
                    }
                }
            }
            else
            {
                if (isTouched == true)
                {
                    touches.X = lastX;
                    touches.Y = lastY;
                    GlideTouch.RaiseTouchUpEvent(null, new TouchEventArgs(touches));
                    isTouched = false;
                }
            }
        }
    }
}

The debug is successful but whenever I touch the screen, it shows “Failed to perform I2C transaction”.
Does anyone has this issue when using Glide?

I have look through all those post. I did try them and ended up same issue.
In addition, I use external power DC 9V , 1.3A.
Seeking if anyone know what happen? any suggestion?

"I tried to reproduce the problem with slightly smaller example provided by andre.m’s reference, and could only get the error to occur if the cable carrying the touch info (component J1 socket on circuit board) was not completely seated; this would intermittently cause an error as described.

@ JeffK I had them placed nicely using gadgeteer cable on port 4 of Cobra II as well the “i” port on CP7. I had my program run in gadgeteer.
I removed the cable, placed it back. and still getting the same issue. Any solution you would recommend?
I found out the problem only occur when I use Glide but not when I use WPF.

Looks like we have a new guru from GHI!

Welcome JeffK!

@ Architect - more like Guru-Wannabee. @ tach0902 (1) how did you find out " the problem only occur when I use Glide but not when I use WPF?" – through experimentation? (2) the cable I’m describing is NOT a gadgeteer cable; rather, it is the smaller of the two ribbon cables attaching the physical display to the CP7 circuit board.

@ JeffK - Yes, I did the experiment. It worked on WPF but not Glide. I wasn’t aware the name of the component you mentioned. Now I found the J1 cable. I just did a quick pull out and have it place it back nicely. It still doesn’t work. same error. What can I do now?

The best would be a minimal example, i.e. start cutting code out, especially the need for the resource file. Then post the minimal example, that way anyone trying to reproduce your error has less variables to deal with.

@ JeffK - Thanks! I will try it and let you know.

XML code:

<Glide Version="1.0.5">
  <Window Name="WindowRGB" Width="800" Height="480" BackColor="11AA88">
    <Button Name="buttonRed" X="20" Y="100" Width="80" Height="32" Alpha="255" Text="Red" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
    <TextBlock Name="instance2754" X="0" Y="2" Width="500" Height="32" Alpha="255" Text="" TextAlign="center" TextVerticalAlign="Top" Font="2" FontColor="FFFFFF" BackColor="000000" ShowBackColor="False"/>
  </Window>
</Glide>

Main window code:

using System;
using System.Collections;
using System.Threading;
using System.IO;
using System.IO.Ports;
using Microsoft.SPOT;
using Microsoft.SPOT.Touch;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;

using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Networking;
using Gadgeteer.Modules.GHIElectronics;
using Gadgeteer.Interfaces;

using GHIElectronics.NETMF.Glide;
using GHIElectronics.NETMF.Glide.Display;
using GHIElectronics.NETMF.Glide.UI;


namespace GlideButtonDemo
{
    public partial class Program
    {
        private static GHIElectronics.NETMF.Glide.Display.Window window;
        private static TextBlock textblock;
        private static Button button;
        
        void ProgramStarted()
        {
            // Do one-time tasks here
            Debug.Print("Program Started");

            // Resize any loaded Window to the LCD's size.
            Glide.FitToScreen = true;

            // Load the Window XML string.
            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window1));

            GlideTouch.Initialize();

            InitWin();
            
            // Assign the Window to MainWindow; rendering it to the LCD.
            Glide.MainWindow = window;
        }

        private static void InitWin()
        {
            textblock = (TextBlock)window.GetChildByName("instance2754");
            textblock.TapEvent += textblock_TapEvent;

            button = (Button)window.GetChildByName("buttonRed");
            button.TapEvent += buttonRed_TapEvent;
        }

        static void textblock_TapEvent(object sender)
        {
            textblock.Text = "YES";            
            textblock.Invalidate();
        }

        static void buttonRed_TapEvent(object sender)
        {
            Mainboard.SetDebugLED(true);
            //Debug.Print("yes3");//led.TurnRed();
        }

I have simplified the code and the results is still “failed to perform I2C transaction”.
Anyone has the idea what is wrong? and could anyone has the same board give a try? I want to know if it’s the hardware issue or software coding error?
Thanks!

Can you run the following code on your device? Does it display circles where you touch?


using Gadgeteer.Modules.GHIElectronics;
using GT = Gadgeteer;

namespace GadgeteerApp2
{
	public partial class Program
	{
		void ProgramStarted()
		{
			display_CP7.ScreenPressed += new Display_CP7.TouchEventHandler(display_CP7_ScreenPressed);
		}

		void display_CP7_ScreenPressed(Display_CP7 sender, Display_CP7.TouchStatus touchStatus)
		{
			if (touchStatus.numTouches > 0)
			{
				var touch = touchStatus.touchPos[0];
				display_CP7.SimpleGraphics.DisplayEllipse(GT.Color.Red, (uint)touch.xPos, (uint)touch.yPos, (uint)25, (uint)25);
			}
		}
	}
}

@ John - Hi, John. The example you suggest me to test. It works!
However, when I use any glide example, none of them work. I wonder what is the issue?

We can reproduce the issue and are working on finding out the cause. We’ll let you know once we find something.

@ John - Okay. Thanks!
Since the only choice I have now is using WPF. Do you have any idea how can I do multiple window using WPF? Thanks!

You can always take a look at the sample SimpleWPF application that ships with NETMF under “Documents\Microsoft .NET Micro Framework 4.2\Samples\SimpleWPFApplication”

You can always try taking a look at Designing User Interfaces | Microsoft Learn to see if that helps.

Are there any news about getting glide and glide touch to work with CP7 ?

@ Clark - I’ll ask around to see what the status is and get back to you.

Glide already have few examples including this one https://www.ghielectronics.com/glide/example/5

Hi Gus
I suppose I need to use GlideTouch.Initialize(); to be able to raise the GildeTouch events?

When I try to use: GlideTouch.Initialize();

I get the Error from Glide saying the I2C has failed, but it’s not throwing an exception.
Have you any suggestions to initialize the Glidetouch?