View Issue Details

IDProjectCategoryView StatusLast Update
0003183FSVybridDIOpublic2017-06-21 13:26
Reporterzutter Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionV2.6 
Target VersionV2.8Fixed in VersionV2.8 
Summary0003183: Interrupt stop working after a while when several interurpts triggered
DescriptionInterrupt stop working after a while when several interurpts triggered.
Steps To ReproduceGetestet auf NetDCUA5/Reporter Kunde ALS Jena
Programm starten und am IOPin6 und IOPin7 Interupts auslösen. Nach kurzer Zeit kommen nur noch Timeouts. Erst nach eine Neustart funktinern die IRQs wieder.

"IRQCfg0A"=dword:0
"IRQCfg1A"=dword:255
"DataDirA"=dword:0
"UseAsIoA"=dword:255
"DEBUG"=dword:255


#include "stdafx.h"
#include "dio_sdk.h"

// Sample program for PicoMOD1
// Creates handle to DIO1: and installs IRQ.
#define EXE_VERSION "001"
static char szWelcome[] = "\r\nSimple IRQ Test: " EXE_VERSION " \r\nUtility to test IRQ usage of Digital I/O PIN.\r\n" \
                          " test_irq <IO-PIN (RegistryValue of the DIO-PIN)>\r\n" \
                          " there is a timeout of 20 seconds set, to push a button" \
                          "Sample: p 1\r\n"; \

HANDLE g_hDIO=NULL;


void ScanPin(HANDLE hDIO, DWORD dwPIN)
{


    if( INVALID_HANDLE_VALUE == hDIO )
    {
        goto leave;
    }

    /*
     * WAITIRQ.dwIOPin = pin number to use as irq.
     * WAITIRQ.dwTimeOut = Timeout in ms to wait for irq.
     * Used for IOCTL_DIO_WAIT_IRQ.
     */
    WAITIRQ cWaitIrq[1];
    cWaitIrq[0].dwIOPin = dwPIN;
    cWaitIrq[0].dwTimeOut = 20000;


    /* Request a sysintr */
    if( !DeviceIoControl(hDIO,IOCTL_DIO_REQUEST_IRQ, &cWaitIrq[0].dwIOPin, sizeof(DWORD), NULL, 0, NULL, NULL) )
    {
        printf(" ERROR: Can't initialize IRQ for PIN %d (Error=%d)\r\n", dwPIN, GetLastError() );
        goto leave;
    }

    DWORD dwCount=0;

    do
    {

        /* Wait for a sysintr */
        DWORD dwWaitRes = -1; /* Return value that
                                       * indicates the event result.
                                       * WAIT_OBJECT_0,
                                       * WAIT_ABANDONED,
                                       * WAIT_TIMEOUT */

        DeviceIoControl(hDIO,IOCTL_DIO_WAIT_IRQ, &cWaitIrq[0], sizeof(WAITIRQ), &dwWaitRes, sizeof(DWORD), NULL, NULL );



        switch( dwWaitRes )
        {
        case WAIT_OBJECT_0:
            RETAILMSG(1,(_T("Event triggered IOPin %d #%d\r\n"), dwPIN, dwCount++));
            /* Call InterruptDone on a sysintr */
            DeviceIoControl(hDIO,IOCTL_DIO_INTDONE_IRQ, &cWaitIrq[0].dwIOPin, sizeof(DWORD), NULL, 0, NULL, NULL );
            break;
        case WAIT_TIMEOUT:
            RETAILMSG(1,(_T("WAIT TIMEOUT\r\n")));
            break;

        }

    }while(true);

leave:
    /* Release a sysintr */
    DeviceIoControl(hDIO,IOCTL_DIO_RELEASE_IRQ, &cWaitIrq[0].dwIOPin, sizeof(DWORD), NULL, 0, NULL, NULL );
    if( INVALID_HANDLE_VALUE != hDIO )
    {
        CloseHandle( hDIO );
    }
}


DWORD WINAPI MyThreadProc2( LPVOID lpParameter )
{
    
    ScanPin(g_hDIO, 6);
    return 1;
}


int _tmain(int argc, TCHAR *argv[])
{
    int nRet=0;
    TCHAR chDevice[_MAX_PATH];
    HANDLE hDIO = INVALID_HANDLE_VALUE ;
    //class CReg cReg;

        // Open the port.
    hDIO = CreateFile (_T("DIO1:"), // Pointer to the name of the port
                        GENERIC_READ | GENERIC_WRITE,
                                      // Access (read-write) mode
                        0, // Share mode
                        NULL, // Pointer to the security attribute
                        OPEN_EXISTING,// How to open the serial port
                        0, // Port attributes
                        NULL); // Handle to port with attribute
                                      // to copy

    g_hDIO=hDIO;

    CreateThread ( NULL, 1024, MyThreadProc2, (LPVOID) NULL, 0, NULL );

    ScanPin(hDIO, 7);

    if( argc == 1 || (argc > 1 && 0 == _tcscmp( argv[1], _T("-?") )) )
    {
        printf( szWelcome );
        goto leave2;
    }

leave2:
    return nRet;
}
Found Driver Version
Fixed Driver Version
Forum Link

Activities

There are no notes attached to this issue.