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.

Compiler/TDA2SX: TDA2SX

Part Number: TDA2SX

Tool/software: TI C/C++ Compiler

Hi!

I want to use GPIO2 interrupt mode through IPU1, Could you provide a valid example? 

Regards

Ming

  • Hi,

    Please refer to PROCESSOR_SDK_VISION_03_06_00_00\ti_components\drivers\pdk_01_10_02_07\packages\ti\csl\example\gpio\.

    Regards,
    Rishabh
  • Hi Rishabh
    the interrupt mode didn't work, exception The exception is as follows :
    [0][ 25.545] Task name: {unknown-instance-name}, handle: 0x9e31bfa4.
    [0][ 25.545] Task stack base: 0x9e330670.
    [0][ 25.545] Task stack size: 0x3ff8.
    [0][ 25.545] R0 = 0x00000000 R8 = 0x0000000a
    [0][ 25.545] R1 = 0x10000000 R9 = 0x01af085a
    [0][ 25.545] R2 = 0x00000000 R10 = 0x00000000
    [0][ 25.545] R3 = 0x00000001 R11 = 0x0000000b
    [0][ 25.545] R4 = 0x00000031 R12 = 0xe00fffe0
    [0][ 25.545] R5 = 0x00000000 SP(R13) = 0x9e334510
    [0][ 25.545] R6 = 0x9e34148f LR(R14) = 0x9d862b85
    [0][ 25.545] R7 = 0x00000000 PC(R15) = 0x9d862b96
    [0][ 25.545] PSR = 0x41000000
    [0][ 25.545] ICSR = 0x0043880e
    [0][ 25.545] MMFSR = 0x00
    [0][ 25.545] BFSR = 0x00
    [0][ 25.545] UFSR = 0x0000
    [0][ 25.545] HFSR = 0x00000000
    [0][ 25.545] DFSR = 0x00000000
    [0][ 25.545] MMAR = 0xe000ed34
    [0][ 25.545] BFAR = 0xe000ed38
    [0][ 25.545] AFSR = 0x00000000

    Regards,
    Ming
  • Hi Ming,

    It seems that you are trying to integrate this example with BIOS.

    In that case you should OSAL APIs.

    Please refer to interrupt usage in VPS examples.

    Regards,

    Rishabh

  • Hi Rishabh,

    gpio2_4 , interrupt mode ,  Calling the GPIOPinIntDisable function in a service routine will trigger an exception:

    [0][     37.716] Unhandled Exception:

    [0][     37.716] Exception occurred in ThreadType_Taskhandle: 0x9e31bfa4.

    [0][     37.716] stack base: 0x9e330670.

    [0][     37.716] R0 = 0x48055000  R8  = 0xffffffff

    [0][     37.716] R1 = 0x00000010  R9  = 0xffffffff

    [0][     37.716] R2 = 0x00000004  R10 = 0xffffffff

    [0][     37.716] R3 = 0x9e35070c  R11 = 0xffffffff

    [0][     37.716] R4 = 0x9e33065c  R12 = 0x9e344480

    [0][     37.716] R5 = 0x00000000  SP(R13) = 0x9e350750

    [0][     37.716] R6 = 0x9d860954  LR(R14) = 0x9d8728e9

    [0][     37.716] R7 = 0xffffffff  PC(R15) = 0x9d8728e8

    [0][     37.716] PSR = 0x01000034

    [0][     37.716] ICSR = 0x00438003

    [0][     37.716] MMFSR = 0x00

    [0][     37.716] BFSR = 0x04

    [0][     37.716] UFSR = 0x0000

    [0][     37.716] HFSR = 0x40000000

    [0][     37.716] DFSR = 0x00000000

    [0][     37.716] MMAR = 0xe000ed34

    [0][     37.716] BFAR = 0xe000ed38

    [0][     37.716] AFSR = 0x00000000

    input mode is ok!

    Code:

    void gpioIsr(void *arg)
    {
    /*Disable interrupt*/
    GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    count++;
    GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    Vps_printf("gpioIsr end! Count:%d\n", count);
    /*Enable interrupt interrupt*/
    GPIOPinIntEnable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    }

    void GPIOInterruptInit(void)
    {
    UnlockMMR(CTRL_CORE_MMR_LOCK_2, CTRL_CORE_MMR_LOCK_2_MMR_LOCK_2_TOUNLOCK);
    IRQXBARConnect(SOC_IRQ_DMARQ_CROSSBAR_REGISTERS_BASE, CPU_IPU1,
    XBAR_INST_IPU1_IRQ_52, GPIO2_IRQ_1);
    UnlockMMR(CTRL_CORE_MMR_LOCK_2, CTRL_CORE_MMR_LOCK_2_MMR_LOCK_2_TOLOCK);
    Intc_Init();
    Intc_IntEnable(0);

    Intc_IntRegister(interrupt_num, (IntrFuncPtr) gpioIsr, (void *) 0);
    Intc_IntPrioritySet(interrupt_num, 1, 0);
    Intc_SystemEnable(interrupt_num);
    }

    void DetectCameraTask(UArg arg1, UArg arg2)
    {
    volatile uint32_t CamOnlineFlag = 0xf;
    volatile uint32_t TmpFlag = 0;

    UnlockMMR(CTRL_CORE_MMR_LOCK_5, CTRL_CORE_MMR_LOCK_5_MMR_LOCK_5_TOUNLOCK);
    GPIOInputOutputSetPinMux();
    UnlockMMR(CTRL_CORE_MMR_LOCK_5, CTRL_CORE_MMR_LOCK_5_MMR_LOCK_5_TOLOCK);

    /*Enable GPIO clock */
    GPIOClockEnable();
    GPIOInterruptInit();
    GPIOModuleReset(gpio_base_address);
    GPIOModuleEnable(gpio_base_address);

    /*Configure and enable debouncing feature*/
    GPIODebounceTimeConfig(gpio_base_address, 0xFF);
    GPIODebounceFuncControl(gpio_base_address, gpio_pin, GPIO_DEBOUNCE_FUNC_ENABLE);
    GPIOIntTypeSet(gpio_base_address, gpio_pin, GPIO_INT_TYPE_RISE_EDGE);
    GPIODirModeSet(gpio_base_address, gpio_pin, gPinDirection);
    /*Clear interrupt*/
    GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);

    /*Enable interrupt*/
    GPIOPinIntEnable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
    Vps_printf("wait for interrupt ...\n");
    while(1)
    {
    ;
    }
    }

  • Hi,

    As I mentioned previously you should not use CSL interrupt APIs in SDK context.
    Please refer to: processors.wiki.ti.com/.../PDK_FAQ

    Regards,
    Rishabh
  • Hi,

    Could you provide a gpio interrupt use case using the OSAL API? there are so many other examples in the vps path.

    Regards,
    Ming

  • Hi Ming,

    Unfortunately we don't have a gpio example using OSAL API. You can refer to PROCESSOR_SDK_VISION_03_04_00_00\vision_sdk\links_fw\src\rtos\utils_common\src\tda3xx\utils_esm..

    Regards,

    Rishabh

  • Hi,

    I haven't heard back from you, I'm assuming you were able to resolve your issue.
    If not, just post a reply below (or create a new thread if the thread has locked due to time-out).

    Regards,
    Rishabh

  • Hi Rishabh,

    I am sorry to reply you late. My problem has not been solved. It is my first time to used TI VSDK, I still haven't figured out how to use them.

    Regards,
    Ming

  • Hi Ming,

    Did you see utils_esm.c? This particular link exactly does the same thing as the one you have mentioned only the module is different.

    ESM is taken from PDK and interrupt is registered in API System_esmInit.

    You do not need any other API calls as done in GPIOInterruptInit.

    Regards,

    Rishabh

  • Hi,

    I haven't heard back from you, I'm assuming you were able to resolve your issue.
    If not, just post a reply below (or create a new thread if the thread has locked due to time-out).

    Regards,
    Rishabh