TI论坛
直播中

刘锦

7年用户 194经验值
私信 关注
[问答]

关于中断嵌套 和 中断堆栈移出的问题

     
      工程师好!
      我使用的是6678 mcsdk中example 的Helloworld例程,源程序中已有Ethernet interrupt(请见下面图1). 我自己在源程序中加入了外部中断,结果发现两个中断会产生中断嵌套,结果出现了中断堆栈溢出的问题。
      中断堆栈溢出后,程序会停在Hwi_Stack.c文件中的ti_sy***ios_hal_Hwi_checkStack() 函数(请见图2)
我想问一下:
1.如何能够避免中断嵌套的问题呢? 可否关闭Ethernet interrupt ?应该如何关闭呢?
2.如果需要两个中断同时存在,则需要如何设置呢?(包括优先级等)
非常感谢!

截图如下:

图1   程序中显示已有Ethernet interrupt


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

回帖(6)

杨娟

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

举报

刘锦

2018-8-6 07:23:15
引用: zbb9612 发表于 2018-8-6 07:07
你这里的中断嵌套是啥意思?中断会使用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 failedn");
return;
]
/* Enable NMIs */
if (CSL_intcGlobalNmiEnable() != CSL_SOK)
[
printf("Error: GEM-INTC global NMI enable failedn");
return;
]
/* Enable global interrupts */
if (CSL_intcGlobalEnable(&state) != CSL_SOK)
[
printf ("Error: GEM-INTC global enable failedn");
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 failedn");
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 failedn");
return;
]
/* Enabling the events. */
if (CSL_intcHwControl(hTest,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
[
printf("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failedn");
return;
]
printf ("Debug: GEM-INTC Configuration Completedn");
]
中断服务程序如下:
void test_isr_handler (void* handle)
[
          SPI_Read_Buffer();
           l++;
           if(l == (ARRAYSIZE/27))
           [
               l = 0;
               flag = 1;
            ]
]
举报

刘锦

2018-8-6 07:39:36
引用: zbb9612 发表于 2018-8-6 07:07
你这里的中断嵌套是啥意思?中断会使用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 failedn");
return;
]
/* Enable NMIs */
if (CSL_intcGlobalNmiEnable() != CSL_SOK)
[
printf("Error: GEM-INTC global NMI enable failedn");
return;
]
/* Enable global interrupts */
if (CSL_intcGlobalEnable(&state) != CSL_SOK)
[
printf ("Error: GEM-INTC global enable failedn");
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 failedn");
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 failedn");
return;
]
/* Enabling the events. */
if (CSL_intcHwControl(hTest,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
[
printf("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failedn");
return;
]
printf ("Debug: GEM-INTC Configuration Completedn");
]
中断服务程序如下:
void test_isr_handler (void* handle)
[
          SPI_Read_Buffer();
           l++;
           if(l == (ARRAYSIZE/27))
           [
               l = 0;
               flag = 1;
            ]
]
举报

刘锦

2018-8-6 07:54:36
引用: zbb9612 发表于 2018-8-6 07:07
你这里的中断嵌套是啥意思?中断会使用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 failedn");
return;
]
/* Enable NMIs */
if (CSL_intcGlobalNmiEnable() != CSL_SOK)
[
printf("Error: GEM-INTC global NMI enable failedn");
return;
]
/* Enable global interrupts */
if (CSL_intcGlobalEnable(&state) != CSL_SOK)
[
printf ("Error: GEM-INTC global enable failedn");
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 failedn");
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 failedn");
return;
]
/* Enabling the events. */
if (CSL_intcHwControl(hTest,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
[
printf("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failedn");
return;
]
printf ("Debug: GEM-INTC Configuration Completedn");
]
中断服务程序如下:
void test_isr_handler (void* handle)
[
          SPI_Read_Buffer();
           l++;
           if(l == (ARRAYSIZE/27))
           [
               l = 0;
               flag = 1;
            ]
]
举报

更多回帖

发帖
×
20
完善资料,
赚取积分