S12XE Port P Interrupt on Both Edges

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S12XE Port P Interrupt on Both Edges

1,952 次查看
rayhall
Contributor V

I have a square wave signals on these pins, PP0, PP1, PP2, PP3, PP4 and PP5. I want an interrupt on both edges. I do not want to count or time the edges. I want to mirror the signals onto pins PT0, PT1, PT2, PT3, PT4 and PT5.

 

I have tried to use ECT in Xgate, but the Interrupts do not work for me.  I see there is a Port P Interrupt vector in XGate. Will this interrupt on all edges on all port P Pins.

 

Ray.

标签 (1)
0 项奖励
回复
5 回复数

1,805 次查看
RadekS
NXP Employee
NXP Employee

Hi Ray,

Thank you for let us know the root cause.

Best Regards,
RadekS

0 项奖励
回复

1,805 次查看
RadekS
NXP Employee
NXP Employee

Hi Ray,

pin interrupt works always only for one type of edge, despite on fact whether this interrupt is handled by CPU or XGATE.

So, you could modify edge settings at every edge or externally route these signals to port T pins and use input capture feature for ECT.

Could you please share here your configuration of ECT and XGATE interrupt routines for a short check?

The typical issue in the case of multiple timer channels is flag clearing mechanism.

Please use “ECT_TFLG1 = 0x01;”  or “ECT_TFLG1 = ECT_TFLG1_C0F_MASK;” instead “ECT_TFLG1_C0F=1;” command. The command “ECT_TFLG1_C0F=1;” is read/modify/write command which will clear all pending flags in this register.


I hope it helps you.

Have a great day,
RadekS

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

0 项奖励
回复

1,804 次查看
rayhall
Contributor V

Radek,

Still no luck. I have included the project files.

Ray.

0 项奖励
回复

1,804 次查看
RadekS
NXP Employee
NXP Employee

Hi Ray,

I shortly looked at your code, and…:

  1. I do not see a command for enable timer in your ECT_Init() function. For example: TSCR1 = 0xE0;
  2. You set port T pins as digital output inside Init_Pins(). When we enable timer, it will overtake control on these pins, however it still could be dangerous because you have these pins connected together with port P output pins. So, there is potential risk of short between these pins.
  3. Note: PE_low_level_init() already enable interrupts.
0 项奖励
回复

1,804 次查看
rayhall
Contributor V

Radek,

I have found the reason the ECT interrupts are not working. I should be using the TIM input capture. This interrupts on Port P pins and not the ECT input capture which uses Port T.

I will change the code so I am using the correct timer.

Ray.

0 项奖励
回复