K20 PIT ISR configuration problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

K20 PIT ISR configuration problem

ソリューションへジャンプ
1,804件の閲覧回数
yvesb
Contributor II

Hi,

I am trying to configure an isr on the K20P100 dev kit (TWRK20D) to blink a LED, using the demo_gpio.c example as basis.

Here's my init routine called by main:

void _init_PIT()

{

   // enable PIT clock

    SIM_SCGC6 |= SIM_SCGC6_PIT_MASK;

   // enable PIT clock, freeze in debug

    PIT_MCR = 0x01;

   // set PIT 3

    PIT_LDVAL3 = 5000000; // setup timer for 5000000 cycles

    PIT_TCTRL3 = PIT_TCTRL_TIE_MASK // enable timer interrupt

                | PIT_TCTRL_TEN_MASK; // enable timer

 

     NVICICPR2 |= 1 << (71%32);

     NVICISER2 |= 1 << (71%32);

}

in the isr.h, I added this:

#undef  VECTOR_87

#define VECTOR_87 isr_pit3

extern void isr_pit3(void);

then I added in demo_gpio.c:

void isr_pit3(void)

{

    PIT_TFLG3 |= 1;

    GPIOC_PTOR |= 1<<PIN_LED_2; 

}

This code doesn't work, execution never goes to isr_pit3() function.

Am I missing something?

Regards,

Yves

ラベル(1)
0 件の賞賛
返信
1 解決策
1,318件の閲覧回数
yvesb
Contributor II

The problem was that declarations in isr.h are ignored and must be written in vectors.h.

However, this doesn't explain why the isr from the example, not declared in vectors.h, worked!!

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,319件の閲覧回数
yvesb
Contributor II

The problem was that declarations in isr.h are ignored and must be written in vectors.h.

However, this doesn't explain why the isr from the example, not declared in vectors.h, worked!!

0 件の賞賛
返信
1,318件の閲覧回数
yvesb
Contributor II

Just noticed that if I use the debug terminal, it displays the following message:

****default_isr entered on vector 87*****

87 is the vector for PIT3. but I don't understand why this message is displayed

0 件の賞賛
返信