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.

C6747中断问题



你好,我采用的是C6747芯片,有以下几个问题请教。

1、跳进中断后,第一次执行清除中断标志位的语句起不了作用,中断标志位不能及时清除,程序在执行完中断服务程序后,会再次跳进中断,再次执行清除中断标志的语句,才会把中断标志位清除,请问这可能是哪里的问题,我实在想不明白。

2、请问有没有用定时器实现定时功能的例程啊?

  • 1.进入中断后,会自动保存GIE,并清除为0,跳出中断时,恢复GIE值,不需要人工清除。

    2. 看一下rcsl里的例程quickStartOMAPL1x_rCSL\OMAPL1x\rCSL_examples\evmOMAPL137\DSP_examples\timer\TIMER_led_blink_frequency_dspL137。
    http://processors.wiki.ti.com/index.php/QuickStartOMAPL1x_rCSL

  • 你好,我用的是I/O中断,进入中断后清除的是对应I/O中断的中断标志位

  • 2. 看一下rcsl里的例程quickStartOMAPL1x_rCSL\OMAPL1x\rCSL_examples\evmOMAPL137\DSP_examples\timer\TIMER_led_blink_frequency_dspL137。
    http://processors.wiki.ti.com/index.php/QuickStartOMAPL1x_rCSL,这个用定时器实现定时功能的例程在哪里?找不到啊

  • 在上面的链接里下载安装Version 2.0: quickStartOMAPL1x_rCSL_2.0

  • 你好,这个里面函数文件不完整啊,主函数里很多子函数定义找不到,包含这些子函数的程序在哪里找呢?

  • 是GPIO上的信号有抖动才导致进2次才退出,不防在ISR里对清除操作做个判断,看第一次进入是否真的清除了,以此来判断是不是抖动导致的第二次置位。

  • 你好,调试时是这样一种现象:第一次执行完中断服务函数以后,ISR相应位是清零的,但是此时程序并没有跳出中断,而是返回中断服务函数最开始继续执行中断服务函数,且执行过程中ISR相应位置1,这样重复几次,才会跳出中断,而且我在中断里的清除对应I/O中断语句,在最后一次执行中断函数时,才起作用。

  • 是不是中断服务函数前没加关键字interrupt啊?把相关代码贴一下。

  • 中断初始化部分:

    void interrupt_Init(void)
    {
    GPIO_BINTEN=0x02; // 使能GPIO BANK 1外部中断
    GPIO_01->SET_FAL_TRIG[1] = 0x001f;
    GPIO_01->CLR_RIS_TRIG[1] = 0x001f;
    GPIO_01->INTSTAT[1] = 0xffff; // 清除GPIO BANK 1中断标志位

    ISTP=0x80000000; // 重置中断向量表到0C00h
    asm(" NOP 2 ");

    CSR = 0xfffe; // 关全局中断
    asm(" NOP 2 ");

    ICR = 0xffff; // 清除中断标志位
    asm(" NOP 2 ");

    IER = 0xffff; // 使能CPU中断
    asm(" NOP 2 ");

    DSP_INTC->INTMUX1=0x00292804;
    asm(" NOP 2 ");
    }

    中断服务函数:

    void interrupt accept ( )
    {
    SWITCH ( );

    GPIO_01->INTSTAT[1]=0xffff; //清除中断标志位

    channel = ( Uint16 ) SWITCH( );

    Offer ( channel, Rec, 70 );
    }

  • #1. 上面的代码没什么大问题。

    #2. 小问题:没有看到使能GIE,中断如何能进入呢。 

           系统中bank 1有几个管脚会送入中断信号?无关的就不要使能其中断触发功能了。

           IER也一样,不用的中断,不要使能。

    #3. 测试时,GPIO上是手动触发的,还是别的芯片提供的,排除抖动的因素。

    #4. 中断向量表怎么写的?

  • #2. GIE在主函数里用下面的语句实现

    CSR=0xffff;
    asm(" NOP 2");

    #3. 测试时,GPIO不是手动触发,是别的芯片提供中断信号

    #4. 中断向量表

    .global _intcVectorTable
    .global _c_int00
    .global _timer0
    .global _accept
    *------------------------------------------------------------------------------
    * Global symbols referenced in this file but defined somewhere else.
    * Remember that your interrupt service routines need to be referenced here.
    *------------------------------------------------------------------------------
    .ref _c_int00

    *------------------------------------------------------------------------------
    * This is a macro that instantiates one entry in the interrupt service table.
    *------------------------------------------------------------------------------
    VEC_ENTRY .macro addr
    STW B0,*--B15
    MVKL addr,B0
    MVKH addr,B0
    B B0
    LDW *B15++,B0
    NOP 2
    NOP
    NOP
    .endm

    *------------------------------------------------------------------------------
    * This is a dummy interrupt service routine used to initialize the IST.
    *------------------------------------------------------------------------------
    _vec_dummy:
    B B3
    NOP 5

    *------------------------------------------------------------------------------
    * This is the actual interrupt service table (IST). It is properly aligned and
    * is located in the subsection .text:vecs. This means if you don't explicitly
    * specify this section in your linker command file, it will default and link
    * into the .text section. Remember to set the ISTP register to point to this
    * table.
    *------------------------------------------------------------------------------
    .sect ".vectors"
    .align 1024

    _intcVectorTable:
    _vector0: VEC_ENTRY _c_int00 ;RESET
    _vector1: VEC_ENTRY _vec_dummy ;NMI
    _vector2: VEC_ENTRY _vec_dummy ;RSVD
    _vector3: VEC_ENTRY _vec_dummy
    _vector4: VEC_ENTRY _vec_dummy
    _vector5: VEC_ENTRY _timer0
    _vector6: VEC_ENTRY _accept
    _vector7: VEC_ENTRY _vec_dummy
    _vector8: VEC_ENTRY _vec_dummy
    _vector9: VEC_ENTRY _vec_dummy
    _vector10: VEC_ENTRY _vec_dummy
    _vector11: VEC_ENTRY _vec_dummy
    _vector12: VEC_ENTRY _vec_dummy
    _vector13: VEC_ENTRY _vec_dummy
    _vector14: VEC_ENTRY _vec_dummy
    _vector15: VEC_ENTRY _vec_dummy

  • 中断vector也没问题。

    这就奇怪了,有没有在accept 的调用函数比如switch( )里操作GIE?

    你是在GPIO_01->INTSTAT[1]=0xffff; //清除中断标志位 这里打断点判断程序没执行到这又回去的吗?

    是每次中断都这样吗?

    其它中断是否正常?