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.

C6748 Timer Interrupt

Other Parts Discussed in Thread: TEST2

 

I will try to use the Timer Interrupt. I made sure that the Timer is running and interrupt occur.

Register bit PRDINTSTAT34;12 in INTCTLSTAT is 1; Interrupt has occurred.

I saw the following methods to try.

- Use Timer0 32bit unchain mode.

- PRD = 0x50000

- TMR0_INTCTLSTAT |= 0x00010001;   // enable timer0 12, 34 interrupt 

- INTMUX1 = 0x00400400; // use INTSEL5, INTSEL6

and intvct.asm file add to project

intvect.asm as follows.

 

; Global symbols defined here and exported out of this file

   .global _intcVectorTable

   .global _c_int00

   .global _TIMER0_TINT12_isr

   .global _TIMER0_TINT34_isr

   .global _vector3

   .global _vector4

   .global _vector5

   .global _TIMER1_TINT12_isr

   .global _TIMER1_TINT34_isr

   .global _vector8

   .global _vector9

   .global _vector10

   .global _vector11

 

; 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).

 .sect  ".vecs"

 .align 1024

 

_intcVectorTable:

_vector0:   VEC_ENTRY _vec_dummy      ;RESET

_vector1:   VEC_ENTRY _TIMER0_TINT12_isr    ;NMI

_vector2:   VEC_ENTRY _TIMER0_TINT34_isr    ;RSVD

_vector3:   VEC_ENTRY _vec_dummy    ;RSVD

_vector4:   VEC_ENTRY _vec_dummy  ;isr0

_vector5:   VEC_ENTRY _vec_dummy  ;isr1

_vector6:   VEC_ENTRY _vec_dummy  ;isr2

_vector7:   VEC_ENTRY _vec_dummy  ;isr3

_vector8:   VEC_ENTRY _vec_dummy

_vector9:   VEC_ENTRY _vec_dummy

_vector10:  VEC_ENTRY _vec_dummy

_vector11:  VEC_ENTRY _vec_dummy

 

Also ISR was used as follows.

void TIMER0_TINT12_isr(void)

{

Tmr_test1++;

}

 

void TIMER0_TINT34_isr(void)

{

Tmr_test2++;

}

 

But Tmr_test1,2 is not increase. 

How to use Interrupt service routine? 

Someone cna help me!

 

Thanks.

 

  • pilhwan doe said:
    _intcVectorTable:
    _vector0:   VEC_ENTRY _vec_dummy      ;RESET
    _vector1:   VEC_ENTRY _TIMER0_TINT12_isr    ;NMI
    _vector2:   VEC_ENTRY _TIMER0_TINT34_isr    ;RSVD
    _vector3:   VEC_ENTRY _vec_dummy    ;RSVD
    _vector4:   VEC_ENTRY _vec_dummy  ;isr0
    _vector5:   VEC_ENTRY _vec_dummy  ;isr1
    _vector6:   VEC_ENTRY _vec_dummy  ;isr2
    _vector7:   VEC_ENTRY _vec_dummy  ;isr3
    _vector8:   VEC_ENTRY _vec_dummy
    _vector9:   VEC_ENTRY _vec_dummy
    _vector10:  VEC_ENTRY _vec_dummy
    _vector11:  VEC_ENTRY _vec_dummy

    I see 12 interrupt vectors here. There are 4 reserved interrupts plus the 12 maskable interrupts for a total of 16 direct CPU interrupts. When building the vector table the first vector should branch to c_int00, the NMI will probably go unused, vectors 2 and 3 are reserved for RTDX, and then 4-15 should be used for your own interrupts. In this case your vector should look something like this:

    _intcVectorTable:
    _vector0:   VEC_ENTRY _c_int00      ;RESET
    _vector1:   VEC_ENTRY _vec_dummy    ;NMI
    _vector2:   VEC_ENTRY _vec_dummy    ;RSVD
    _vector3:   VEC_ENTRY _vec_dummy    ;RSVD
    _vector4:   VEC_ENTRY _TIMER0_TINT12_isr  ;isr0
    _vector5:   VEC_ENTRY _TIMER0_TINT34_isr  ;isr1
    _vector6:   VEC_ENTRY _vec_dummy  ;isr2
    _vector7:   VEC_ENTRY _vec_dummy  ;isr3
    _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
    This plugs your ISRs into interrupts 4 and 5. Then you can tie the events to those interrupts in INTMUX1 (INTSEL4 = 4, INTSEL5 = 64). You will also need to to enable the interrupt enable bits for those interrupts (IER |= 0x30;). It looks like you are on the right track. Just finish up these last steps and you should be closer to seeing your interrupts fire. Another side note is that it would be easier to use DSP/BIOS to set all this up, but if you don't want BIOS that is OK too.