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.

RTOS/TMS320C6678: NDK and GPIO interrupt (integrating GPIO interrupt into NIMU_emacClientExample)

Part Number: TMS320C6678
Other Parts Discussed in Thread: CODECOMPOSER, SYSBIOS

Tool/software: TI-RTOS

CCSv7.3.0.00019

SDK v04.01.00.06

  • CG_XML 2.41.00
  • CTools Library 2.2.0.0
  • DSPLIB 3.4.0.0
  • EDMA3 LLD 2.12.05.29
  • FFTLIB 3.1.0.0
  • Framework Components 3.40.02.07
  • IMGLIB 3.1.1.0
  • IPC 3.46.02.04
  • LIBARCH 1.0.0.0
  • LINALG 1.2.0.0
  • MATHLIB 3.1.1.0
  • NDK 2.25.01.11
  • OpenMP 2.06.02.00
  • PDK C667X 2.0.7
  • Processor SDK RTOS C667X 04.01.00.06
  • SYS/BIOS 6.46.05.55
  • TI CGT 6x 8.1.3
  • UIA 2.00.06.52
  • XDAIS 7.24.00.04
  • XDCtools 3.32.01.22

Hello, I need to catch gpio interrupts while using NDK, so I added to the client.c the following (processors.wiki.ti.com/.../Configuring_Interrupts_on_Keystone_Devices)

  1. #include <xdc/runtime/Error.h>
    #include <ti/csl/csl_gpio.h>
    #include <ti/csl/csl_gpioAux.h>

  2. void gpio_isr_handler(UArg arg)
    {
    printf("GPIO interrupt!!!\n");
    }

  3. Hwi_Handle myHwi;

    int init_gpio_interrupt_hwi(char pinNum, char intNum)
    {
    Int32 instNum = 0;
    Uint8 bankNum = 0;

    hGpio = CSL_GPIO_open(instNum);
    CSL_GPIO_setPinDirOutput (hGpio, pinNum);
    CSL_GPIO_setRisingEdgeDetect (hGpio,pinNum);
    CSL_GPIO_bankInterruptEnable (hGpio,bankNum);

    printf("Mapping GPIO%d (Event%d) to INT%d...\n",pinNum,pinNum+74,intNum);

    Hwi_Params hwiParams;
    Error_Block eb;

    Hwi_Params_init(&hwiParams);
    Error_init(&eb);

    // set the argument you want passed to your ISR function
    hwiParams.arg = 1;

    // set the event id of the peripheral assigned to this interrupt
    hwiParams.eventId = pinNum+74;

    // don't allow this interrupt to nest itself
    hwiParams.maskSetting = Hwi_MaskingOption_SELF;

    //
    // Configure interrupt intNum to invoke "gpio_isr_handler".
    // Automatically enables interrupt intNum by default
    // set params.enableInt = FALSE if you want to control
    // when the interrupt is enabled using Hwi_enableInterrupt()
    //

    myHwi = Hwi_create(intNum, gpio_isr_handler, &hwiParams, &eb);

    if (Error_check(&eb)) {
    // handle the error
    }

    return 0;
    }

  4. int StackTest()

    {

    int rc;
    int i;
    HANDLE hCfg;
    CI_SERVICE_TELNET telnet;
    CI_SERVICE_HTTP http;
    NIMU_QMSS_CFG_T qmss_cfg;
    NIMU_CPPI_CFG_T cppi_cfg;

    init_gpio_interrupt_hwi(15,10);

    if (setupRm ())

    {
    NIMU_testLog ("Function setupRm failed\n");
    System_flush();
    goto main_exit;
    }

    ...

    I got the statement in console

    Then when I tried to set the interrupt using CodeComposer Registers it seems interrupt didn't work (my gpio_isr_handler didn't print the message)


    How can I achieve my goal: configure gpio interrupt while using NDK? All gpio interrupt examples I found are working standalone, so I think there's a collision between ndk interrupts and my interrupts.