A very strange phenomena which I read about on this forum earlier ( but cannot find any reference to it).
In case I feed my board via the cerbuino usb-client port, connected to my PC, the application slows down significant, and executes very slow and behaves abnormal.
Connecting the board via an usb-power adapter , the application behaves normally.
Unfortunately bad results, the usb-connection with the PC still slows down the execution of the code. A usb-sniffer shows that there is communication on the bus, so I wonder whether the usb-driver of the Cerbuino is in some kind of polling wait-process…?
In my case this phenomena is very anoying because timing is essential for my application…
Mainboard.SetDebugLED(false);
Debug.Print("Program Started");
Mainboard.SetDebugLED(true);
Thread.Sleep(200);
Mainboard.SetDebugLED(false);
for (int i = 0; i < 500000; )
{
i = i + 1;
}
Mainboard.SetDebugLED(true);
Thread.Sleep(200);
Mainboard.SetDebugLED(false);
I cannot reproduce the phenomena anymore after I had restarted my PC , probably a clean start of VS is responsible for solving this issue?
…but I notice a significant difference in execution time in case the application is started via the debugger session, without the debugger attached the execution time is 4 to 5 times faster. I can image that the overhead of the debugger is responsible for that?
John, a new insight: I can now reproduce the phenomena I described in my post.
In case I switch off the usb-driver for the Cerbuino on my PC, the application runs normally.
Could it be that the usb-communication takes a portion of ram, which may hamper the application? Knowing that my application has only 10-15kbyte of ram left during execution.
Then I started the gadgeteer programme (see example post #5), I observed a 40 seconds delay before the code is actually executed.
A board or firmware issue? I reloaded the loader and the 4.3 firmware, no success, still a delay. Then I reinstalled the SDK , no success, same effect.
Then (I dont know why) , I made a console version of the same testprogramme, and yep!, the code executed normally. Also after detaching the debugger, and the resetting the board, the code executed immidiately, no 40 seconds delays anymore.
Then I reloaded the original Gadgeteer testprogramma, et voila!, the application executed normally.
I have no idea whats happening under the hood of this system…