Strange timing behaviour


Consider the following code, on a SC20260 dev board :

 var pin = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PJ13);

            while (true)

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 :wink:

I will create an issue on Github.


We have seen this happen and then it stopped happening.

@Dat_Tran maybe this only happens at 2ms?

I’ve tried with many different timings and it’s the same each time : 4ms more than expected.

With 1ms you have only 1ms added. The expected period of 2ms becomes 4ms.

We added to our issue list and will check in shortly.