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.

【求助】关于中断嵌套 和 中断堆栈移出的问题

Other Parts Discussed in Thread: SYSBIOS

     

      工程师好!

      我使用的是6678 mcsdk中example 的Helloworld例程,源程序中已有Ethernet interrupt(请见下面图1)我自己在源程序中加入了外部中断,结果发现两个中断会产生中断嵌套,结果出现了中断堆栈溢出的问题。

      中断堆栈溢出后,程序会停在Hwi_Stack.c文件中的ti_sysbios_hal_Hwi_checkStack() 函数(请见图2)

我想问一下:

1.如何能够避免中断嵌套的问题呢? 可否关闭Ethernet interrupt ?应该如何关闭呢?

2.如果需要两个中断同时存在,则需要如何设置呢?(包括优先级等)

非常感谢!

截图如下:

图1   程序中显示已有Ethernet interrupt

   图2   中断堆栈溢出后,程序会停在Hwi_Stack.c文件中的ti_sysbios_hal_Hwi_checkStack() 函数

  • 你这里的中断嵌套是啥意思?中断会使用system stack,如果是堆栈溢出,可以增加system stack size,如果增大size还是出现问题极有可能不是堆栈溢出导致,并且可以在ccs tools下的mcsa工具查看system stack的使用状态。

     

  • 我换个问法吧,就是说,我在我的RTOS 工程中使用了外部中断方式来启动TCP协议中的send发送,例程参考的是cpintc.c。

    感觉中断设置的不正确,使得程序在send()处阻塞。

    我的中断初始化程序及中断服务程序如下,请看一下是否有问题呢?

    另外我看到对于RTOS需要在SYS/BIOS中设置中断,我采用CSL API函数设置可以吗?

    若不可以,有无相关RTOS配置中断的例程呢?

    非常感谢!

    中断初始化程序如下”:

    void Intc_Init(void)
    {
           printf ("Debug: GEM-INTC Configuration...\n");
           /* INTC module initialization */
    intcContext.eventhandlerRecord = EventHandler;
    intcContext.numEvtEntries = 10;

    if (CSL_intcInit(&intcContext) != CSL_SOK)
    {
    printf("Error: GEM-INTC initialization failed\n");
    return;
    }

    /* Enable NMIs */
    if (CSL_intcGlobalNmiEnable() != CSL_SOK)
    {
    printf("Error: GEM-INTC global NMI enable failed\n");
    return;
    }

    /* Enable global interrupts */
    if (CSL_intcGlobalEnable(&state) != CSL_SOK)
    {
    printf ("Error: GEM-INTC global enable failed\n");
    return;
    }

    /* Open the INTC Module for Vector ID: 4 and Event ID: 88 (C6678) GPIO_14
    * Refer to the interrupt architecture and mapping document for the Event ID (INTC0_OUT3)*/

    vectId = CSL_INTC_VECTID_4;
    hTest = CSL_intcOpen (&intcObj, 88, &vectId , NULL);
    if (hTest == NULL)
    {
    printf("Error: GEM-INTC Open failed\n");
    return;
    }

    /* Register an call-back handler which is invoked when the event occurs. */
    EventRecord.handler = &test_isr_handler;
    EventRecord.arg = 0;

    if (CSL_intcPlugEventHandler(hTest,&EventRecord) != CSL_SOK)
    {
    printf("Error: GEM-INTC Plug event handler failed\n");
    return;
    }

    /* Enabling the events. */
    if (CSL_intcHwControl(hTest,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
    {
    printf("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failed\n");
    return;
    }
    printf ("Debug: GEM-INTC Configuration Completed\n");

    }

    中断服务程序如下:

    void test_isr_handler (void* handle)
    {
              SPI_Read_Buffer();
               l++;
               if(l == (ARRAYSIZE/27))
               {
                   l = 0;
                   flag = 1;
                }
    }

  • 我换个问法吧,就是说,我在我的RTOS 工程中使用了外部中断方式来启动TCP协议中的send发送,例程参考的是cpintc.c

    感觉中断设置的不正确,使得程序send()处阻塞

    我的中断初始化程序及中断服务程序如下,请看一下是否有问题呢?

    另外我看到对于RTOS需要在SYS/BIOS中设置中断,我采用CSL API函数设置可以吗?

    若不可以,有无相关RTOS配置中断的例程呢?

    非常感谢!

    中断初始化程序如下:

    void Intc_Init(void)
    {
           printf ("Debug: GEM-INTC Configuration...\n");
           /* INTC module initialization */
    intcContext.eventhandlerRecord = EventHandler;
    intcContext.numEvtEntries = 10;

    if (CSL_intcInit(&intcContext) != CSL_SOK)
    {
    printf("Error: GEM-INTC initialization failed\n");
    return;
    }

    /* Enable NMIs */
    if (CSL_intcGlobalNmiEnable() != CSL_SOK)
    {
    printf("Error: GEM-INTC global NMI enable failed\n");
    return;
    }

    /* Enable global interrupts */
    if (CSL_intcGlobalEnable(&state) != CSL_SOK)
    {
    printf ("Error: GEM-INTC global enable failed\n");
    return;
    }

    /* Open the INTC Module for Vector ID: 4 and Event ID: 88 (C6678) GPIO_14
    * Refer to the interrupt architecture and mapping document for the Event ID (INTC0_OUT3)*/

    vectId = CSL_INTC_VECTID_4;
    hTest = CSL_intcOpen (&intcObj, 88, &vectId , NULL);
    if (hTest == NULL)
    {
    printf("Error: GEM-INTC Open failed\n");
    return;
    }

    /* Register an call-back handler which is invoked when the event occurs. */
    EventRecord.handler = &test_isr_handler;
    EventRecord.arg = 0;

    if (CSL_intcPlugEventHandler(hTest,&EventRecord) != CSL_SOK)
    {
    printf("Error: GEM-INTC Plug event handler failed\n");
    return;
    }

    /* Enabling the events. */
    if (CSL_intcHwControl(hTest,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
    {
    printf("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failed\n");
    return;
    }
    printf ("Debug: GEM-INTC Configuration Completed\n");

    }

    中断服务程序如下:

    void test_isr_handler (void* handle)
    {
              SPI_Read_Buffer();
               l++;
               if(l == (ARRAYSIZE/27))
               {
                   l = 0;
                   flag = 1;
                }
    }

  • 我换个问法吧,就是说,我在我的RTOS 工程中使用了外部中断方式来启动TCP协议中的send发送,例程参考的是cpintc.c

    感觉中断设置的不正确,使得程序send()处阻塞

    我的中断初始化程序及中断服务程序如下,请看一下是否有问题呢?

    另外我看到对于RTOS需要在SYS/BIOS中设置中断,我采用CSL API函数设置可以吗?

    若不可以,有无相关RTOS配置中断的例程呢?

    非常感谢!

    中断初始化程序如下:

    void Intc_Init(void)
    {
           printf ("Debug: GEM-INTC Configuration...\n");
           /* INTC module initialization */
    intcContext.eventhandlerRecord = EventHandler;
    intcContext.numEvtEntries = 10;

    if (CSL_intcInit(&intcContext) != CSL_SOK)
    {
    printf("Error: GEM-INTC initialization failed\n");
    return;
    }

    /* Enable NMIs */
    if (CSL_intcGlobalNmiEnable() != CSL_SOK)
    {
    printf("Error: GEM-INTC global NMI enable failed\n");
    return;
    }

    /* Enable global interrupts */
    if (CSL_intcGlobalEnable(&state) != CSL_SOK)
    {
    printf ("Error: GEM-INTC global enable failed\n");
    return;
    }

    /* Open the INTC Module for Vector ID: 4 and Event ID: 88 (C6678) GPIO_14
    * Refer to the interrupt architecture and mapping document for the Event ID (INTC0_OUT3)*/

    vectId = CSL_INTC_VECTID_4;
    hTest = CSL_intcOpen (&intcObj, 88, &vectId , NULL);
    if (hTest == NULL)
    {
    printf("Error: GEM-INTC Open failed\n");
    return;
    }

    /* Register an call-back handler which is invoked when the event occurs. */
    EventRecord.handler = &test_isr_handler;
    EventRecord.arg = 0;

    if (CSL_intcPlugEventHandler(hTest,&EventRecord) != CSL_SOK)
    {
    printf("Error: GEM-INTC Plug event handler failed\n");
    return;
    }

    /* Enabling the events. */
    if (CSL_intcHwControl(hTest,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
    {
    printf("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failed\n");
    return;
    }
    printf ("Debug: GEM-INTC Configuration Completed\n");

    }

    中断服务程序如下:

    void test_isr_handler (void* handle)
    {
              SPI_Read_Buffer();
               l++;
               if(l == (ARRAYSIZE/27))
               {
                   l = 0;
                   flag = 1;
                }
    }

  • 不可以在bios工程中使用CSL配置INTC,关于Bios及非Bios下中断配置参考:

    http://processors.wiki.ti.com/index.php/Configuring_Interrupts_on_Keystone_Devices

  • 谢谢 Andy Yin1 !

    这应该就是症结所在了!

    我再看一下!