How to install a timer interrupt

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

How to install a timer interrupt

ソリューションへジャンプ
1,990件の閲覧回数
wendersonolivei
Contributor IV

Hi All,

 

I was using timer interrupt with PEx, but when I tried to install an isr manually it doesn't work.

That's my code:

 

void tpm1_interr(void *user_isr_ptr) {      Bit2_NegVal(); //Output led      TPM1_SC |= 0x10000000; //Clears TOF flag by writing a logical '1' }   void Task1_task(uint32_t task_init_data) //Main task {      _int_install_isr(LDD_ivIndex_INT_TPM1, tpm1_interr, NULL);      TPM1_SC = 0xF;      TPM1_CNT = 0x2;      TPM1_MOD = 0x0000ffff;      TPM1_C0SC = 0x00000050;      TPM1_C0V = 0x0000ffff;      for(;;)      {           _time_delay_ticks(300);      } }

 

When I try to play the program the debugger goes at this unhandled exception isr:

 

PE_ISR(Cpu_Interrupt) {        /* This code can be changed using the CPU component property "Build Options / Unhandled int code" */        PE_DEBUGHALT(); }

 

Why this is happening? My isr_install is wrong?

Thanks,

Original Attachment has been moved to: full-code-(isr-install).zip

タグ(3)
0 件の賞賛
返信
1 解決策
1,662件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

HI

Sorry I forgot to add opensda debug support in this project.  now I attached the updated version.


Have a great day,
Daniel

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
1,662件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi

I attached an example to install interrupt handler, for your reference. You can set break point in Task1_task, at the last line, you can get the result, isr_ptr->TICK_COUNT is 200.

This task installs a new ISR to replace the timer ISR.,   It then waits for some time, finally printing out the    number of times the ISR ran.


Have a great day,
Daniel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,662件の閲覧回数
wendersonolivei
Contributor IV

Hi Daniel,

I tried to make a code, like as your example, but it stills doesn't works.

I attached my code, can you give a little look on this?

Thanks,

0 件の賞賛
返信
1,663件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

HI

Sorry I forgot to add opensda debug support in this project.  now I attached the updated version.


Have a great day,
Daniel

0 件の賞賛
返信
1,662件の閲覧回数
wendersonolivei
Contributor IV

Now i can run this on my FRDM, it's working fine!

Thanks a lot, have a nice day.

Wenderson

0 件の賞賛
返信
1,662件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi

I think the vector number (in your code is LDD_ivIndex_INT_TPM1) is not right