FEZ Hydra problems with CP7 display

Hi everyone,

I’m new to netmf gadgeteer and I’m having a couple of issues with the FEZ Hydra and the CP7 display.

Before I delve in, I’ll say that I have the latest TinyCLR firmware and Tinybooter 4.2.6.2.

On my computer I have Visual Studio 2010 Express, NETMF SDK 4.2, and NETMF and Gadgeteer Package 2014 R1 installed.

And here is the major caveat… I’m building my project in visual basic. I did some searching here and didn’t find too much help for vb, though I now c# and vb get compiled into the same .net code basically. The reason I chose VB is because at my job, VB.Net 2010 is used extensively and it would really be beneficial for me to learn it. I figured this project would be a good opportunity to get two birds with one stone.

Ok, here are the two issues I’m having:

  1. I can’t seem to run debug mode while using the cp7. Every time the project gets deployed, the following message turns up in the debug output screen:

[quote]Using mainboard GHI Electronics FEZHydra version 1.2
Updating display configuration. THE MAINBOARD WILL NOW REBOOT.
To continue debugging, you will need to restart debugging manually (Ctrl-Shift-F5)[/quote]

Whenever I actually hit Ctrl-Shift-F5, it basically goes through the entire deploy process again and I end up with the same message, right back where I was.

I saw another topic on this issue that basically entailed including the display module library in your project, or editing and rebuilding the display module, but as a newbie I’m a bit unsure about this method, and I don’t think the project inclusion would really work since I’m using VB.

  1. I saw the following on the Hydra developer guide for changing the pixel clock divider to stop flickering:

Register LCDCON1 = new Register(0x00500800);
LCDCON1.ToggleBits(0x2000);

Sure enough, when I use purple text, I can see flickering clear as day. Unfortunately, I’m unsure how to implement this fix in VB as “Register” doesn’t seem to be a supported type. Is this because I am failing to include the proper resource/namespace/library or something? Or would this be implemented completely differently in VB? Searching on the subject results in an inundation of hits on dealing with the “registry,” not “registers.”

Is it possible to address this through FEZConfig as well?

Thanks everyone in advance- I’m very much looking forward to learning this platform and getting to the point where I can build modules on my own.

Jon

Ugh, it seems I’m having more issues I didn’t really notice.

When I hit the play button in VS2010 with only the FEZ Hydra and CP7 hooked up via usbDP module, it deploys, resets a few times (which kills debugging as described in my previous post), and then normally runs the program as coded, but without debug. Sometimes, it takes more than a few resets. It can sit there for a couple minutes and continuously reset before it starts the program finally- seemingly by sheer luck.

I was experimenting with Glide when I discovered how bad this issue was… I created the following simple program:

Imports GT = Gadgeteer
Imports GTM = Gadgeteer.Modules
Imports Gadgeteer.Modules.GHIElectronics
Imports GHI.Glide
Imports GHI.Glide.Display
Imports GHI.Glide.UI






Namespace FEZHydraCP7GUITest
    Partial Public Class Program

        ' This is run when the mainboard is powered up or reset. 
        Public Sub ProgramStarted()
            '*******************************************************************************************
            ' Hardware modules added in the Program.gadgeteer designer view are used by typing 
            ' their name followed by a period, e.g.  button.  or  camera.
            '
            ' Many hardware modules generate useful events. To set up actions for those events, use the 
            ' left dropdown box at the top of this code editing window to choose a hardware module, then
            ' use the right dropdown box to choose the event - an event handler will be auto-generated.
            '*******************************************************************************************/

            ' Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started")
            'Thread.Sleep(1000)

            Dim testwindow As Window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.windowtest))

            Glide.MainWindow = testwindow

        End Sub

        ' If you want to do something periodically, declare a GT.Timer by uncommenting the below line
        '   and then use the dropdown boxes at the top of this window to generate a Tick event handler.
        ' Dim WithEvents timer As GT.Timer = new GT.Timer(1000)  ' every second (1000ms)

    End Class
End Namespace

With the glide window coming from windowtest.txt in my resources:

[quote]






[/quote]

All I wanted to do was to get it to display what I created with glide. well, I hit play in VS2010, it deploys, then resets and interrupts debug, and then goes into the reset loop. The difference, is that now that loop takes much longer. Eventually, at some magical point, you can see the glide window on there.

Here’s the odd part… when it’s in the reset loops, you can’t really stop it. Turn it off, power back on, and it continues. since it’s constantly resetting, you can’t really talk to it either. But, once it gets past that and you can see what you drew (as in my original case) or what you created in glide as I posted here, it won’t go into the reset loop when you power down and then back on. It’s as if it keeps trying to run an LCD config but isn’t successful, but after that one time it is successful you’re good to go. Of course, once you try to deploy/debug again, the frustrating reset loop process starts again.

Also, this is only with the CP7 attached. I can play with the other modules all day long without resets while enjoying debug mode.

This is getting frustrating. It’s impossible to even begin working on my GUI with this stuff happening. Any help would be appreciated.

Thanks,
Jon

hi Jon, welcome to the forum.

I’m not a big screen user so can’t really help too much there. But what you describe seems to me to be similar to what people say about when a project doesn’t initialise the screen correctly in the firmware - I can only suggest you take a short trip into a C# Gadgeteer project, drag the CP7 in, and deploy that code. Hopefully, we can get it so that a double reboot is no longer necessary.

If you want to see if your program runs more than “initialisation” code, once you deploy code via Visual Studio, you can open MFDeploy and connect to the device there, and watch debug messages (it’s not the same as debugging, I know) but it might show important errors or messages you’re not seeing otherwise

Hi Brett,

Your assessment of the screen not getting initialized correctly in firmware feels like the right one given what I’ve observed.

I suppose I’ll work on building a c# project with just the hydra, dp module, and cp7 and see what happens. I would think that the result would be the same.

I’ll also see if mfdeploy can shed some light on the subject. I did run FEZConfig and looked at the lcd configuration on the board which seemed ok. Of course, I can only communicate with the board and read the configuration once it finally initializes, so that doesn’t tell me much.

Thanks,
Jon

Ok, I just typed a very long post, and lost all of it. Ugh, this has not been a fun day.

So, I took my first VB program to do some simple graphics on the CP7:


Imports GT = Gadgeteer
Imports GTM = Gadgeteer.Modules
Imports Gadgeteer.Modules.GHIElectronics




Namespace FEZHydraCP7test
    Partial Public Class Program

        Dim numtouch As Integer = 0
        Dim xpos As Integer = 0
        Dim ypos As Integer = 0

        ' This is run when the mainboard is powered up or reset. 
        Public Sub ProgramStarted()
            '*******************************************************************************************
            ' Hardware modules added in the Program.gadgeteer designer view are used by typing 
            ' their name followed by a period, e.g.  button.  or  camera.
            '
            ' Many hardware modules generate useful events. To set up actions for those events, use the 
            ' left dropdown box at the top of this code editing window to choose a hardware module, then
            ' use the right dropdown box to choose the event - an event handler will be auto-generated.
            '*******************************************************************************************/

            ' Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started")
            'Thread.Sleep(1000)

            ' Displays "Hello World" on the screen in red text at screen coordinates 100,100
            display.SimpleGraphics.DisplayText("Hello World", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 100, 100)

        End Sub

        Private Sub display_BackPressed(ByVal sender As Gadgeteer.Modules.GHIElectronics.Display_CP7) Handles display.BackPressed
            display.SimpleGraphics.DisplayTextInRectangle("Back to the Future", 300, 300, 200, 30, GT.Color.Purple, Resources.GetFont(Resources.FontResources.NinaB))

        End Sub

        Private Sub display_HomePressed(ByVal sender As Gadgeteer.Modules.GHIElectronics.Display_CP7) Handles display.HomePressed
            display.SimpleGraphics.Clear()
        End Sub

        Private Sub display_MenuPressed(ByVal sender As Gadgeteer.Modules.GHIElectronics.Display_CP7) Handles display.MenuPressed
            display.SimpleGraphics.DisplayText("No Menu Yet", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 350, 250)
        End Sub

        Private Sub display_ScreenPressed(ByVal sender As Gadgeteer.Modules.GHIElectronics.Display_CP7, ByVal touchStatus As Gadgeteer.Modules.GHIElectronics.Display_CP7.TouchStatus) Handles display.ScreenPressed

            display.SimpleGraphics.DisplayRectangle(GT.Color.Black, 1, GT.Color.Black, 90, 190, 50, 130)
            numtouch = touchStatus.numTouches
            display.SimpleGraphics.DisplayText(CStr(numtouch), Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 100, 200)
            xpos = touchStatus.touchPos(numtouch - 1).xPos
            display.SimpleGraphics.DisplayText(CStr(xpos), Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 100, 250)
            ypos = touchStatus.touchPos(numtouch - 1).yPos
            display.SimpleGraphics.DisplayText(CStr(ypos), Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 100, 300)
            display.SimpleGraphics.DisplayEllipse(GT.Color.Cyan, xpos, ypos, 10, 10)

        End Sub

        ' If you want to do something periodically, declare a GT.Timer by uncommenting the below line
        '   and then use the dropdown boxes at the top of this window to generate a Tick event handler.
        ' Dim WithEvents timer As GT.Timer = new GT.Timer(1000)  ' every second (1000ms)

        Private Sub display_ScreenReleased(ByVal sender As Gadgeteer.Modules.GHIElectronics.Display_CP7) Handles display.ScreenReleased

            Debug.Print("Screen Press Release Detected")
            display.SimpleGraphics.DisplayEllipse(GT.Color.Red, xpos, ypos, 10, 10)

        End Sub

    End Class
End Namespace

This code never let me get into debug, even if the config loaded and I hit Ctrl-Shft-F5. I created some similar code in C#:


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

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

namespace FEZHydraCP7Test
{
    public partial class Program
    {
        int numtouch = 0;
        int xpos = 0;
        int ypos = 0;
        
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/


            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            display_CP7.SimpleGraphics.DisplayText("Hello World", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 100, 100);
            display_CP7.ScreenPressed += new Display_CP7.TouchEventHandler(display_CP7_ScreenPressed);
            display_CP7.ScreenReleased += new Display_CP7.TouchEventHandlerTouchReleased(display_CP7_ScreenReleased);
            display_CP7.HomePressed += new Display_CP7.TouchEventHandlerHomeButton(display_CP7_HomePressed);
            display_CP7.BackPressed += new Display_CP7.TouchEventHandlerBackButton(display_CP7_BackPressed);
            display_CP7.MenuPressed += new Display_CP7.TouchEventHandlerMenuButton(display_CP7_MenuPressed);
        }

        void display_CP7_MenuPressed(Display_CP7 sender)
        {
            display_CP7.SimpleGraphics.DisplayText("No Menu Yet", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 350, 250);
        }

        void display_CP7_BackPressed(Display_CP7 sender)
        {
            display_CP7.SimpleGraphics.DisplayTextInRectangle("Back to the Future", 300, 300, 200, 30, GT.Color.Purple, Resources.GetFont(Resources.FontResources.NinaB));
        }

        void display_CP7_HomePressed(Display_CP7 sender)
        {
            display_CP7.SimpleGraphics.Clear();
            display_CP7.SimpleGraphics.DisplayText("Hello World", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 100, 100);
        }

        void display_CP7_ScreenReleased(Display_CP7 sender)
        {
            Debug.Print("Screen Press Release Detected");
            display_CP7.SimpleGraphics.DisplayEllipse(GT.Color.Red, (uint) xpos, (uint) ypos, 10, 10);
        }

        void display_CP7_ScreenPressed(Display_CP7 sender, Display_CP7.TouchStatus touchStatus)
        {
            display_CP7.SimpleGraphics.DisplayRectangle(GT.Color.Black, 1, GT.Color.Black, 90, 190, 50, 130);
            numtouch = touchStatus.numTouches;
            xpos = touchStatus.touchPos[numtouch - 1].xPos;
            ypos = touchStatus.touchPos[numtouch - 1].yPos;
            display_CP7.SimpleGraphics.DisplayText(numtouch.ToString(), Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 100, 200);
            display_CP7.SimpleGraphics.DisplayText(xpos.ToString(), Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 100, 250);
            display_CP7.SimpleGraphics.DisplayText(ypos.ToString(), Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, 100, 300);
            display_CP7.SimpleGraphics.DisplayEllipse(GT.Color.Cyan, (uint) xpos, (uint) ypos, 10, 10);
        }
    }
}


That fired up right into debug mode no problem. I assume it didn’t need to change the config?

Well, then I tried the following in C# to just display a glide window like in my second post:


using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
//using Microsoft.SPOT.Presentation;
//using Microsoft.SPOT.Presentation.Controls;
//using Microsoft.SPOT.Presentation.Media;
//using Microsoft.SPOT.Presentation.Shapes;
//using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
using GHI.Glide;
using GHI.Glide.Display;
using GHI.Glide.UI;

namespace FEZHydraCP7GlideTest
{
    public partial class Program
    {
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/


            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            Window windowtest = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.testwindow));
            Glide.FitToScreen = true;
            Glide.MainWindow = windowtest;

        }
    }
}


It went into the reset loop for a couple minutes, and then displayed the window, just like the VB version. However, when I hit Ctrl-Shft-F5, it loaded right up into debug mode. Oddly enough, I tried the VB version again and that also managed to get into debug mode. presumably because it didn’t need to change the display config.

I thought I’d be smart, load the simple C# graphics code I first tested with in this post, and then try to load the VB version of that, but that didn’t work. Hitting Ctrl-Shft-F5 for that one in VB is just running a hamster wheel.

In summary, it seems that C# does a more consistent job, so maybe I’ll go with that instead. However, the real problem is why do I keep running into the reset loop when changing display configs. Likely, if I can fix that problem, VB will work as well. However, I’m still quite green and any help debugging this would be most appreciated.

Thanks,
Jon

Just a quick update… I figured out the screen flicker issue by searching through posts (GHI should probably update the hydra developer guide since the fix there no longer works), but I’m still having trouble with the hydra repeatedly resetting when trying to update the display config.

Is it possibly a power issue since I’m powering the hydra and cp7 with the usbDP module? I know that the module cuts it close power wise, but it seems that plenty of people use the two in combination. Is it possibly the firmware version? I’m using the latest. Is it possibly the SDK version? I figured the 2014 R2 would be stable. The release notes mentioned some problems with hydra, cp7, and touch while using uart, but I’m not doing that.

I’m just at a loss of what to do, especially since I’m a newbie with this.

I’m using a powered USB hub rated up to 2w and I’ve also tried a 12v wall supply with the same result.

The only thing I haven’t tried is using the power extender module, but I’d think the usbDP module should be enough for only the hydra and cp7 as others have done.

Ok, so I ponied up the dough for a power extender module thinking that might fix the problem, but apparently not. I have a usbDP client to the hydra mainboard which is powered by a 2A usb hub, and a 12v wall wart going to the power extender module for the cp7.

Still, whenever I try to deploy and debug and it wants to change the display configuration, it goes into a long loop of resetting until finally, by some stroke of luck, it takes and I can actually do some development.

I did notice during that debugging it thinks it’s a 1.2 hydra board, but my pcb says rev 1.3. I don’t know if this could be related or not.

Does anyone have any advice or knowledge about this issue? Did I get a buggy board? Is it potentially an emi issue? I don’t think I’m doing anything wrong in my code…

Is there a way I can set up for manual display configuration and use debug to pinpoint the issue?

Thanks,
Jon