Timer issue

  • Hello,


    We are in the proces of porting our vb.net application from a NetDCU8 to a NetDCUA5 and encountered a problem with the timer we use. We use the Timer function from System.Windows.Forms to perform some action and we noticed that when we set the interval to 100ms, on the NetDCUA5 the interval actually is 150ms. On the 'old' NetDCU8 this works fine, the interval is 100ms. We also tested with other intervals and there is a difference between the NetDCU8 and the NetDCUA5.


    Do you know what could cause this difference? Could the upgrade from windows CE 5.0 to Windows CE 6.0 perhaps have something to do with it?


    Kind regards,
    Menno

  • Hello,


    Windows Timer are not very accurate. But 50ms seems very inaccurate and should not occur. I am also sure that the OS it not the reason for this behavior.


    Did you do your tests without running other background threads, so that we can exclude slow down by other problems?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello, any news?


    i did a quick test using a dialog based application (see below). Timer seems to be ok. So i assume the problem is caused by a driver or by your applcation. Please give us more details.



    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello,


    Sorry for my late response. I ran the test application you ran on your machine and I got a different response:


    Result1:
    Timer periode is 67 await 20
    Timer periode is 34 await 30
    Timer periode is 44 await 40
    Timer periode is 88 await 50
    Timer periode is 76 await 60
    Timer periode is 75 await 70
    Timer periode is 84 await 80
    Timer periode is 94 await 90
    Timer periode is 124 await 100
    Timer periode is 128 await 110
    Timer periode is 128 await 120
    Timer periode is 135 await 130
    Timer periode is 145 await 140
    Timer periode is 154 await 150
    Timer periode is 164 await 160
    Timer periode is 177 await 170
    Timer periode is 184 await 180
    Timer periode is 207 await 190
    Timer periode is 204 await 200
    Timer periode is 214 await 210
    Timer periode is 238 await 220


    Another test:
    Timer periode is 49 await 20
    Timer periode is 32 await 30
    Timer periode is 42 await 40
    Timer periode is 52 await 50
    Timer periode is 70 await 60
    Timer periode is 73 await 70
    Timer periode is 82 await 80
    Timer periode is 97 await 90
    Timer periode is 129 await 100
    Timer periode is 128 await 110
    Timer periode is 128 await 120
    Timer periode is 132 await 130
    Timer periode is 142 await 140
    Timer periode is 152 await 150
    Timer periode is 162 await 160
    Timer periode is 188 await 170
    Timer periode is 182 await 180
    Timer periode is 209 await 190
    Timer periode is 202 await 200
    Timer periode is 212 await 210
    Timer periode is 240 await 220


    When i changed the timer to 10ms continues:
    Timer periode is 39 await 10
    Timer periode is 13 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 39 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 39 await 10
    Timer periode is 13 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 39 await 10
    Timer periode is 13 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 12 await 10
    Timer periode is 39 await 10


    And 100ms:
    Timer periode is 133 await 100
    Timer periode is 129 await 100
    Timer periode is 128 await 100
    Timer periode is 128 await 100
    Timer periode is 129 await 100
    Timer periode is 129 await 100
    Timer periode is 129 await 100
    Timer periode is 129 await 100
    Timer periode is 128 await 100
    Timer periode is 128 await 100
    Timer periode is 129 await 100
    Timer periode is 128 await 100
    Timer periode is 128 await 100
    Timer periode is 129 await 100
    Timer periode is 128 await 100
    Timer periode is 128 await 100
    Timer periode is 129 await 100
    Timer periode is 128 await 100
    Timer periode is 128 await 100
    Timer periode is 128 await 100
    Timer periode is 128 await 100
    Timer periode is 128 await 100


    Looks like the timer on my device is less accurate than on your device. Do you have an idea of what the problem could be? The application I tested with is the same, so a driver problem?

  • Hello,


    When I tested your application earlier I had Cerdisp running. When I tested again without cerdisp the result was ok. So maybe that explains the variation in results.


    The issue I had does however still exist. After reading about the multimedia timer library on your forum I created a test app in c++ that uses the mmtimer library. The application uses the timer with an interval of 100ms. When the interval occurs the application first opens a valve via a Digital I/O port and on the next interval it closes it. When we externally validate the DIO port with an oscilloscope it shows a change at 150ms, not 100ms.When we test it with an interval of 50ms, the change still occurs at 150ms. When we test with an interval of 200ms, the change occurs at 200ms. It seems there is some sort of limit at 150ms. When we test on a NetDCU8 the test runs perfectly! So, the question still is, why is there a difference between the 2 devices and why is the NetDCUA5 not working correct at intervals lower than 150ms? Have you got any ideas?


    Kind regards,
    Menno

  • Hello,


    did you do the tests "stand alone" or via dubugger or additional HW accesses? I assume another thead is higher priorisizde and cancels your timers calculation time. Which other features do you use in your test?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello,


    The test is a standalone test of a console application. this is the code:



    the writeport function that is used is in another DLL. The code is:


    When we run this program and attach an oscilloscope to the digital IO port it shows a change at 150ms, not 100ms. When we run the program on a NetDCU8 the change is correct at 100ms.

  • Sorry, I am working on an other project. But i try to answer within this week.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello,


    i did a quick check with another A5 Board which is just on my desk. I access "WritePort" without using a DLL (implement the code directly). Even 25ms are working very accurate!
    Can you confirm?
    Causes the DLL the delay?
    Can you post the DLL?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello,


    We did some more testing, and tried your suggestion to implement the "Writeport" function directly. It did not have the effect, but we did discover another thing. We had serial debug output enabled in the EBoot and when we run the program it logs a lot of data. We were unaware that so much was being logged!


    This is a short snippet:



    When we disable the logging in EBoot the interval is accurate!


    Kind regards,
    Menno

  • Ah ok, and you disable the log by set the drivers "debug" value to zero via registry?
    You have not to disable debug output at all.


    Thanks for your cearyfication.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.