Main Site Documentation

Mode/execution speed changes when prompted by reset button


#1

I experience a change in behaviour when presseing the reset button.
For me, it looks like the clock speed is reduced (like in a eco mode), but when i build it from visual studio it is running at full speed.

Do I have to change mode, or can I force it to run at a certain speed?
Answers is appreciated !


#2

Answers is appreciated !

Before answers… questions…

First question… On what did you press the reset button?

Second… How do you know the clock speed is reduce after pressing the reset button?

Third… have you tried to test with a very simple program to see if the same condition exists after hitting reset?


#3

this sounds like the “debug messages got nowhere to go” problem. Attach the debugger and see if “performance” goes to normal.


#4

This is a known issue with a work around on GitHub. You can safely ignore it. Next release should fix it.


#5

I press the Reset button on the FEZ card, which restart the code rooted from the card itself.
Hovewer, if conected to a computer and running the program in visual studio, the execution speed increases like if VS takes controll after a short while.

I ran a simple program and measured with a oscilocpe setting pins high and low. However, now I tried to set a PWM, and this frequency is constant, so the clck is most certantly constant.

The debuger seems like a viable explenation. Ty for the help!


#6

solution. Found the patch on github for the FEZ.

using System.Runtime.InteropServices; //Needed as library

    static void Patch()
    {

        // BrainPad, FEZCLR
        const int MODE_ADDRESS = 0x20001438;
        const int EVENT_ADDRESS = 0x20001ef8;
        const int OFFSET = 0;

        var isUsbDebugMode = Marshal.ReadInt32(IntPtr.Add(new IntPtr(OFFSET), MODE_ADDRESS)) != 0 ? true : false;
        var value = Marshal.ReadInt32(IntPtr.Add(new IntPtr(OFFSET), (EVENT_ADDRESS))) | (isUsbDebugMode ? 512 : 256);
        Marshal.WriteInt32(IntPtr.Add(new IntPtr(OFFSET), EVENT_ADDRESS), value);
    }