TI论坛
直播中

黄鼎

8年用户 151经验值
私信 关注
[问答]

请问C6743串口接收中断,运行程序后又返回主函数里,不进中断服务程序是什么原因?

C6743串口接收中断在给DSP发送数之后能观察到CSR的GIE变为0,在中断向量表里设置断点也能跳进去,但是继续运行程序后又返回主函数里啦,不进中断服务程序????

回帖(12)

余少虹

2018-7-25 09:21:05
请问你中断向量表和中断服务子程序具体是怎么写的?
 
举报

黄鼎

2018-7-25 09:27:32
引用: vuywsdfwf 发表于 2018-7-25 09:21
请问你中断向量表和中断服务子程序具体是怎么写的?
 

*------------------------------------------------------------------------------
* Global symbols defined here and exported out of this file
*------------------------------------------------------------------------------
   .global _vectors
   .global _c_int00
   .global _vector1
   .global _vector2
   .global _vector3
   .global _vector4
   .global _vector5
   .global _UART_ISR
   .global _vector7
   .global _vector8
   .global _vector9  
   .global _vector10
   .global _vector11  
   .global _vector12 
   .global _vector13  
   .global _vector14  ; Hookup the c_int14 ISR in main()
   .global _vector15
*------------------------------------------------------------------------------
* Global symbols referenced in this file but defined somewhere else.
* Remember that your interrupt service routines need to be referenced here.
*------------------------------------------------------------------------------
   .ref _c_int00
   .ref _UART_ISR
*------------------------------------------------------------------------------
* 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
_vectors:
_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 _vec_dummy
_vector6:   VEC_ENTRY _UART_ISR
_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  ; Hookup the c_int14 ISR in main()
_vector15:  VEC_ENTRY _vec_dummy
*------------------------------------------------------------------------------
 interrupt void UART_ISR() //中断响应函数
[
     CSR&=0xfffffffe; // 关中断 GIE=0
  asm(" NOP 1 ");
  ICR = 0xfff0;                // 清除中断标志ICR
  flag=0;
  asm(" NOP 1 ");
  CSR=CSR|1;    // 开中断
  printf("hello");
]
举报

余少虹

2018-7-25 09:33:21
引用: ruimalyx 发表于 2018-7-25 09:27
*------------------------------------------------------------------------------
* Global symbols defined here and exported out of this file
*------------------------------------------------------------------------------

这两段程序没什么问题。
看一下ISTP寄存器有没有设置好中断向量表地址?
举报

黄鼎

2018-7-25 09:38:33
引用: vuywsdfwf 发表于 2018-7-25 09:33
这两段程序没什么问题。
看一下ISTP寄存器有没有设置好中断向量表地址?

您好,我设置ISTP寄存器啦,附件上是我的程序,您帮我看下到底是哪里的问题,谢谢啦!!!此串口程序不用中断时是能正常收发的
举报

更多回帖

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