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.

c6713 EXT_INT5 interrupt question

I am writing a program to use EXT_INT5 interrupt.  However, it seems not work.  Here is my code:

; Vectors_intr.asm Vector file for interrupt INT11
   .global _vectors    ;global symbols
   .global _c_int00
   .global _vector1
   .global _vector2
   .global _vector3
   .global _vector4
   .global _vector5  ; for INT 5
   .global _vector6
   .global _vector7
   .global _vector8
   .global _vector9  
   .global _vector10
   .global _isrDetection     
   .global _vector12 
   .global _vector13  
   .global _vector14
   .global _vector15

   .ref _c_int00    ;entry address
  

VEC_ENTRY .macro addr   ;macro for ISR
    STW   B0,*--B15
    MVKL  addr,B0
    MVKH  addr,B0
    B     B0
    LDW   *B15++,B0
    NOP   2
    NOP  
    NOP  
   .endm

_vec_dummy:
  B    B3
  NOP  5

 .sect ".vectors"    ;aligned IST section
 .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          ;ISR address
_vector6:   VEC_ENTRY _vec_dummy
_vector7:   VEC_ENTRY _vec_dummy
_vector8:   VEC_ENTRY _vec_dummy
_vector9:   VEC_ENTRY _vec_dummy
_vector10:  VEC_ENTRY _vec_dummy
_vector11:  VEC_ENTRY _isrDetection      
_vector12:  VEC_ENTRY _vec_dummy
_vector13:  VEC_ENTRY _vec_dummy
_vector14:  VEC_ENTRY _vec_dummy
_vector15:  VEC_ENTRY _vec_dummy

 

In the main() program,  the codes looks like:

 GPIO_Config  GPIOcfg={
  GPIO_FMKS(GPGC,  GP0M,   GPIOMODE)     |
  GPIO_FMKS(GPGC,  GPINT0M, PASSMODE)    |
  GPIO_FMKS(GPGC,  GPINTPOL, LOGICTRUE)  |
  GPIO_FMKS(GPGC,  LOGIC,   ORMODE)      |
  GPIO_FMKS(GPGC,  GPINTDV, DELTAMODE),
  
  GPIO_FMKS(GPEN,  GPXEN,  OF(0)),     
  GPIO_FMKS(GPDIR, GPXDIR, OF(0)),    
  GPIO_FMKS(GPVAL, GPXVAL, OF(0)),
  GPIO_FMKS(GPDH,  GPXDH,  OF(0x00)),
  GPIO_FMKS(GPHM,  GPXHM,  OF(0x00)),
  GPIO_FMKS(GPLM,  GPXLM,  OF(0x0)),
  GPIO_FMKS(GPPOL, GPINTXPOL, OF(0))
 };

  hGpio = GPIO_open(GPIO_DEV0, GPIO_OPEN_RESET);
 GPIO_config(hGpio, &GPIOcfg);

 IRQ_setVecs(vectors);
 IRQ_globalDisable();
 IRQ_globalEnable();       /* Globally enable interrupts       */
 for(i=0;i<32;i++)
 {
     IRQ_disable(i);   /* Disable and clear all IRQ events    */
     IRQ_clear(i);     /* except reset and NMI interrupts     */
 }
    IRQ_map(IRQ_EVT_EXTINT4, 11);
    IRQ_reset(IRQ_EVT_EXTINT4);
    IRQ_enable(IRQ_EVT_EXTINT4);

 

 I've enabled the interrupt individually, also set up the interrupt in the vectors_intr.asm file. The program gets compiled with no errors.   Did I configured the GPIO incorrectly? 

I am very grateful for your any advice or help? 


   

 

 

  • Greetings,

    You will need not to use this macro for the reset vector.  Please read the following thread http://e2e.ti.com/support/dsp/tms320c6000_high_performance_dsps/f/115/p/153708/581922.aspx#581922

    Good Luck,

    Sam

  • Do you have example code that came with the DSK6713?

    Have you connected CCS and the emulator on the board to do any debug?

    firephenix405 said:
    However, it seems not work.

    You need to figure out a lot more about what is not working so that you can debug this, or to be able to describe the problem for someone to offer help. Take it slow and consider each step between reset and main().

    It would be interesting to know where you got examples or found information that led you to the code example you have above. Please let us know.

    Regards,
    RandyP

  • Out of curiosity...

    Does:

        STW   B0,*--B15
        MVKL  addr,B0
        MVKH  addr,B0
        B     B0

    work?

    Is it the B0 before MVKL that goes into the stack?

    Is MVKH ready before B B0?

    Another thing, does this work:

    _vec_dummy:
      B    B3
      NOP  5

    Is the interrupt return address in B3 in this device?

    In C6482 the interrupt return address goes to megamodule IRP register.


  • I referred to the vector.asm  from the book "DSP and application with C6713 and C6416 DSK".   

    I take your guys advice and working on what's wrong with my codes.  I'll let you know the results. 

  • Greetings,

    In thread I pointed you to, there is a viable solution for your problem.

    Reset vector can not use such a macro because the DSP just got released from reset and its B15 (SP) contain unknown value, and when you push the unknown value of B0 onto memory pointed to by B15, you get unknown results.

    Use the following

     _vector0:                           ; RESET

      MVKL _c_int00, B0

      MVKH _c_int00, B0

      B B0

     NOP

      NOP

      NOP

      NOP

      NOP

     _vector1:   VEC_ENTRY _vec_dummy    ; NMI

     _vector2:   VEC_ENTRY _vec_dummy    ; RSVD

     _vector3:   VEC_ENTRY _vec_dummy    ; RSVD

    .

    .

    Good Luck,

    Sam