This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

setup interrupt not working wce 7

Other Parts Discussed in Thread: DM3730

#define IRQ_BUTTON    101, also tried 55 with same result

when I set the mode to GPIO_INT_LOW, the interrupt constantly comes in and won't stop(even when I pull the pin high)

when I set the mode to any other mode (high, lowhigh, or highlow), the interrupt never triggers.

I am using Variscite's DVK board  with the DM3730 cpu under WinCE Compact 7

I have errors coming  back from all those GPIOxxx function

    gButtonsIntrEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

    // Open GPIO driver
    hGPIO = GPIOOpen();
    if (hGPIO == NULL)
        {
        RETAILMSG(1, (TEXT("ERROR: PddInitializeHardware: Failed open GPIO device driver\r\n")));
        return (0);
        }

    // Setup IRQ for input mode, falling edge detect, debounce enable
    //GPIOSetMode(hGPIO, IRQ_BUTTON, GPIO_DIR_INPUT|GPIO_INT_LOW); //this have constant trigger, even if we pull it high. other trigger can't be triggered no matter what
//    GPIOSetMode(hGPIO, IRQ_BUTTON, GPIO_DIR_INPUT|GPIO_INT_HIGH_LOW|GPIO_DEBOUNCE_ENABLE);
    GPIOSetMode(hGPIO, IRQ_BUTTON, GPIO_DIR_INPUT|GPIO_INT_LOW_HIGH|GPIO_DEBOUNCE_ENABLE);
//    GPIOSetMode(hGPIO, IRQ_BUTTON, GPIO_DIR_INPUT|GPIO_INT_HIGH);
//    GPIOPullup(hGPIO, IRQ_BUTTON,GPIO_PULLUP_ENABLE);

    DWORD ibit=0x55aa55aa;
    ibit=GPIOGetMode(hGPIO, IRQ_BUTTON);
    RETAILMSG(1, (TEXT("*********** BTN: get mode=%d\r\n"),ibit));

    if (!GPIOInterruptInitialize(hGPIO, IRQ_BUTTON,    &SysIntrValue, gButtonsIntrEvent)) //this does GPIOGetSystemIrq, IOCTL_HAL_REQUEST_SYSINTR, and InterruptInitialize
    {
        RETAILMSG(1, (TEXT("Couldn't Initialize interrupt GPIOInterruptInitialize.\r\n")));
        return 0;
    }

    // Set the interrupt as a wake-up source
    if (!GPIOInterruptWakeUp(hGPIO, IRQ_BUTTON, SysIntrValue, TRUE))

    {
        RETAILMSG(1, (TEXT("ERROR: BTN: Couldn't get valid SysIntr.\r\n")));
        return(0);
    }

    //SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);

    RETAILMSG(1, (TEXT("%s +BtnButton IST\r\n"),DRVR_NAME));
    while (1)
    {
        WaitForSingleObject(gButtonsIntrEvent, INFINITE);
        Sleep(10);
        RETAILMSG(1, (TEXT("%s got intr\r\n"),DRVR_NAME));
//        InterruptDone(SysIntrValue);
        GPIOInterruptDone(hGPIO, IRQ_BUTTON, SysIntrValue); //this seems to be same as above; InterruptDone()
    }   // end while  

  • I have also try to read the state of the GPIO pin and they don't change.

    the EE guy put in a pull up to the pin, the state doesn't change.

    I try GPIO 55, which is the user push button on the Variscite's DVK board, they the state doesn't change when you push it.

    also tried the GPIOPullup(hGPIO, IRQ_BUTTON,GPIO_PULLUP_ENABLE); and the state still don't change.

        // Open GPIO driver
        hGPIO = GPIOOpen();
        if (hGPIO == NULL)
            {
            RETAILMSG(1, (TEXT("ERROR: PddInitializeHardware: Failed open GPIO device driver\r\n")));
            return (0);
            }

    #if 1
        DWORD r=0xaa55aa55;
        GPIOSetMode(hGPIO, IRQ_BUTTON, GPIO_DIR_INPUT);
        r=GPIOGetMode(hGPIO, IRQ_BUTTON);
        RETAILMSG(1, (TEXT("*********** BTN: get mode=%d\r\n"),r));
        //GPIOPullup(hGPIO, IRQ_BUTTON,GPIO_PULLUP_ENABLE);
        while (1)
        {
            r=GPIOGetBit(hGPIO, IRQ_BUTTON);
            RETAILMSG(1, (TEXT("*********** BTN: bit=%d\r\n"),r));
            Sleep(1000);
        }

    #endif

  • The problem is the pinmux configuration need to be "configured" and it's in define GPIO_PADS_37XX in bsp_pagcfg.h

    similar to this here: http://e2e.ti.com/support/embedded/wince/f/353/t/128475.aspx

    I got the gpio 55 to work after changing the MUXMODE from 3 to 4.

        PAD_ENTRY(CAM_D2,            INPUT_ENABLED | PULL_RESISTOR_ENABLED  | PULLUP_RESISTOR | MUXMODE(4))                                                 /* GPIO 101  :temp test irq*/        \

    CAM_D2 is gpio 101. also works.

    I wish there comments in the GPIOxxx driver code that mentions this and I wouldn't so much time on this.