Netdcu8 external interrupt behaviour, throughput the system

  • Hello


    For a future application I needed to test external interrupt capabilities of a Netdcu8. For this I connected a signal generator as interrupt input source to J5 Pin2 and measure
    J5 Pin 7 (configured as output) with a scope. On interrupt rising edge at input Pin 2 I clear output Pin 7 and at interrupt falling edge I set it to high.
    With this I want to see the time behaviour "through the system" without load and later under load.


    So the first test was to apply some "easy" frequency input in the sub KHz area, around 158Hz. What I realized on scope was surprising me.
    I speak now from the rising edge only. I saw a non surprising Jitter of about 250us(microseconds) where the output signal follows the input rising edge, this was something expected when reading the www, they give you values like this.
    But then, approximately 900us later in time there is also 250us Jitter area where the output signal comes low.
    Unfortunately I am not able to insert my scope picture here. I could send the scope picture per email if it helps.
    I think this beavoiur is not ok. Could anyone explain this? I post the code, but this is nothing special, same as in F&S manuals. But may be you find something bad.
    By the way, no other software was running, so ther was nearly no other system load.


  • Well, this is really odd. I had a quick look into the DIO driver source and there is nothing that can block the IOCTL_DIO_CLR_PIN and IOCTL_DIO_SET_PIN functions at all. Therefore I don't see what can cause this long delay. However we had some issues with edge triggered interrupts that were solved in Kernel 1.37 (080602). So are you sure that you use a sufficiently new kernel?


    Two comments about your code:


    - The check for STOP in your loop does not work. The break there does only break the switch, but not the while loop.
    - InterruptDone should only be done in case WAIT_OBJECT_0.

    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.

  • I tried user defined Kernel from 15.3.10 and I tried V1.45 Kernel. Behaviour is the same.


    The STOP work´s fine, why don´t you believe? It is set by debugger to true with a breakpoint.


    I will think about InterruptDone() to use only in WaitForSingleObject(). I am not sure what happens If I leave WaitForSingleObject() without a real interrupt.
    After this, no interrupt would be possible without reboot.


    Have you made already such test like I described with signal generator at input and scope at an output?


    Or could be some issue with wiring of my input signal? I use a standard signal generator TTL output and wire that via a 1k resistor to the
    3,3V input of Pin2. Pin 2 doesn´t need a pull up, so you desrcibed it in your documents. I measure 3,4V at the input of Pin2.

  • Quote from "andyinfsnet"

    I tried user defined Kernel from 15.3.10 and I tried V1.45 Kernel. Behaviour is the same.


    That's sad. I hoped using a newer kernel would be the solution.


    Quote

    The STOP work´s fine, why don´t you believe? It is set by debugger to true with a breakpoint.


    Ah, OK, I missed the additional check for STOP in the while condition. So yes, you're right, STOP is working.


    Quote

    I am not sure what happens If I leave WaitForSingleObject() without a real interrupt.


    If there really was no interrupt, there is no problem at all. But think of the following case. Assume your call to WaitForSingleObject() returns with a value different to WAIT_OBJECT_0, for example with WAIT_TIMEOUT while using a real timeout, not INFINITE. But immediately after this return from WaitForSingleObject() while running your code and right before your call to InterruptDone(), the interrupt does actually happen. If you call InterruptDone() now, then you're acknowledging an interrupt that you haven't actually seen and handled in your thread yet. Doing this, you might miss an interrupt because the kernel thinks it can already signal the next interrupt while you still need to be signaled about the current interrupt.


    Quote

    Have you made already such test like I described with signal generator at input and scope at an output?


    I'm sorry, but we don't have the time right now to do such a complex test on such a rather aged platform like the NetDCU8. But I have the following suggestion. In WinCE 5.0, there still were all the remote tools included with Embedded Visual C++ (menu "Tools"). Try to connect the Kernel Tracker for a few seconds when running your program. The Kernel Tracker will log the task switches of the program and shows this as a rather useful graphic. Probably you'll find out yourself what process/thread causes the delay. Only connect for a short period of time as the amount of collected data is tremendous. You should see a regular switch to your thread with every interrupt edge, but some of these entry points will be delayed. These are the interesting points. Check what thread/process caused this delay, i.e. what thread is running before finally switching to your thread. Maybe you need to output the thread ID in your program so that you know which is your thread in the Kernel Tracker output.


    Quote

    Or could be some issue with wiring of my input signal? I use a standard signal generator TTL output and wire that via a 1k resistor to the
    3,3V input of Pin2. Pin 2 doesn´t need a pull up, so you desrcibed it in your documents. I measure 3,4V at the input of Pin2.


    I think, this should work. I see no mistake here.

    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.