PicoMod 4 GPIO

  • Hallo,


    ich möchte gerne beim PicoMod4 (falsches Forum, aber einen eigenen Bereich gibt es noch nicht) die Digitalen IO Pins nutzen, die auf einen Interrupt reagieren sollen. Hierfür verwende ich den IOPin GPIO5.
    Dafür habe ich die folgenden Registry eingefügt.



    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\DIGITALIO]
    "UseAsIOA"=0x4200
    "IRQCfg0A"=0x200
    "DataDirA"=0x4000
    "Prefix"="DIO"
    "Dll"="DIGIO.dll"
    "Order"=0x97
    "Index"=0x1
    "Ioctl"=0x4
    "Port"=0x1
    "FriendlyName"="Digital I/O driver for PicoMOD4"



    Mein Code lautet wie folgt:
    digio.h

    Code
    1. #include <dio_sdk.h>


    digio.cpp


    Das Problem ist, dass er immer beim Request ein FALSE zurück gibt. Leider weis ich nicht weiter. Können sie mir da weiter helfen?


    PS: GetLastError() gibt die 50 raus: ERROR_NOT_SUPPORTED 50: The request is not supported...
    PPS: Das mit der PicoMod3 mitgelieferte Programm: "USE_DIO" liefert den gleichen Fehler beim PicoMod4. Bei der PicoMod3 kommt es zu einem Fehler bei:
    "InterruptInitialize( dwSysIntr,hIsrEvent, NULL, 0 )" mit Code 87 (Falscher Parameter)


    [admin edit: Moved into newly created PicoMOD4 forum]

  • I am really sorry. There still is a bug in the PicoMOD Device Driver Documentation. On WindowsCE 6 based systems the IO-Control to registers an interrupt is IOCTL_DIO_REQUEST_IRQ instead of IOCTL_DIO_REQUEST_SYSINTR.

    Software developer, F&amp;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.

  • thx, this part works now. but there is still an error in my program:
    i modified the exampleprogram: "dio_test" as follow:


    .h


    .cpp


    Now the "InterruptInitialize(...)" function returns an error:
    Error initializing interrupt, InitInterrupt() failed (87)


    Any ideas?

  • The InterruptInitialize() function is no more available on WindowsCE 6. This by the way is the same reason that the IOCTL_DIO_REQUEST_SYSINTR Io-Control is no more usable on CE 6. On CE6 the principle operation is as follows:



      1. Initialize the interrupt at the DIO driver: IOCTL_DIO_REQUEST_IRQ (replaces IOCTL_DIO_REQUEST_SYSINTR)
      2. Afterwards you can wait for the interrupt event with IOCTL_DIO_WAIT_IRQ (replaces WaitForSingeObject())
      3. To re-enable the DIO-Interrupt you must call IOCTL_DIO_INTDONE_IRQ (replaces InterruptDone())
      4. To unregister and release the interrupt you may call IOCTL_DIO_RELEASE_IRQ (replaces IOCTL_DIO_RELEASE_SYSINTR) before exiting your programm.


    This mechanism is documented correctly in the PicoMOD3 Device Driver Documentation. Only the IO-controls IOCTL_DIO_REQUEST_SYSINTR and IOCTL_DIO_RELEASE_SYSINTR values must be replaced with the new one. We will correct this and clearify the differences to the "old" interface used on Windows CE 5.

    Software developer, F&amp;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.

  • Hallo, i have still a problem with my DIO pins. Nothing still happends when i try to rise my DIO pin. My code looks as follows:



    my registry entries looks as follows:


    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\DIGITALIO]
    "UseAsIOA"=0x8000
    "IRQCfg2A"=0x0
    "IRQCfg1A"=0x0
    "IRQCfg0A"=0x1
    "DataDirA"=0x0
    "Prefix"="DIO"
    "Dll"="PM4_DIGIO.dll"
    "Order"=0x97
    "Index"=0x1
    "Ioctl"=0x4
    "Port"=0x1
    "FriendlyName"="Digital I/O driver for PicoMOD4"


    My program should use the pins GPIO2 (and GPIO1) as input-pin. When i will set the PIN44 (J5 I/O Pin5 [and J5 I/O Pin16 to GND]) to high (3,3V), an interrupt should appear.


    thx for your answers

  • so, now it works. i changed my reg settings to:


    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\DIGITALIO]
    "UseAsIOA"=0x8000
    "IRQCfg2A"=0x8000
    "IRQCfg1A"=0x0
    "IRQCfg0A"=0x8000
    "DataDirA"=0x0
    "Prefix"="DIO"
    "Dll"="PM4_DIGIO.dll"
    "Order"=0x97
    "Index"=0x1
    "Ioctl"=0x4
    "Port"=0x1
    "FriendlyName"="Digital I/O driver for PicoMOD4"


    I think the problem was, that the rising edge time was too large.

  • Hallo, my interrupt problem is still there. I tried to enable the GPIO1 and GPIO2. Therefore i changed the reg settings to:


    "UseAsIOA"=0xC000
    "IRQCfg2A"=0xC000
    "IRQCfg1A"=0x0
    "IRQCfg0A"=0xC000


    (Bit IO15 and IO14 to 1)


    The code looks as follows:


    Now my problem: This works just sometimes! Sometimes everything works great. Sometimes nothing works, that is no interrrupt is set and the function GetLastError() returns an invalid handler. Sometimes one Pin works, the other not. In most cases the PIN44 (J5 Starterkit Pin5) works and Pin41 (J5 Starterkit Pin1) doesn't work. After restart of this program the result is changing. After all i tried the debug and the release mode.
    When i get the voltage at this pins, i get always 2V at PIN44 when my display is insert. That is the reason, why the GPIO2 often set the interrupt.


    I'm using the PicoMOD Device Drivers Version 1.4 Date: 2009-06-15 and the PicoMOD3-Startinterface Hardware Version 0.10 Date 7.5.2008, but for my PicoMod4. Are there maybe changes in the position of the GPIO pins? Must there be always a closed electric circuit between the GPIO pins and the GND pin or is it enough, when i just contact the GPIO pin? (I tried both without any differece).