Hello,
Consider the following code, on a SC20260 dev board :
var pin = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PJ13);
pin.SetDriveMode(GpioPinDriveMode.Output);
while (true)
{
pin.Write(GpioPinValue.High);
Thread.Sleep(2);
pin.Write(GpioPinValue.Low);
Thread.Sleep(2);
}
Pin PJ13 is INT on Mikrobus socket #2.
Launch it from Visual Studio and you get a very good (and expected) 4.06 ms period.
Now reset the board (using the Reset button) and you will now get 8ms period !
In fact, it adds 2ms per cycle, hence the (2+2)+(2+2) period.
You can check with any other value greater than 2 and you will see a constant 2ms added on each Thread.Sleep() when not in debugger.
If you relaunch the app from VS, you will get the expected 4ms period again.
That’s quite funny if you remember the opposite issue with TinyCLR 1.0
I will create an issue on Github.
Regards,
Christophe