Rising and Falling Edge GPIO ISR not working as Expected (MBD MPC574x)

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

Rising and Falling Edge GPIO ISR not working as Expected (MBD MPC574x)

3,138件の閲覧回数
abhishek_kumar1
Contributor IV

Dear All

I am using DEVKIT-MPC5744P Board (REV-E).

I am using a GPO to toggle a pin and using the same ping to provide input to another GPI

I am trying to use Rising Edge Detection and Falling Edge Detection using different GPI ISR blocks. (shown below) 

pastedImage_1.png

To test i use an LED. for falling edge it shall be off and for rising edge it shall be on. But the LED stays on. Somehow both ISR for same pin is not working in this toolbox. Please provide your input.

Model is attached. 

Best Regards,

Abhishek

mariuslucianandrei‌, rafael.barbosa@chassisbrakes.com

タグ(1)
0 件の賞賛
返信
8 返答(返信)

2,923件の閲覧回数
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

So you can only get 1 ISR block for 1 pin - but you can set it to trigger on both edges, and check inside the ISR the pin value. You can either use the input block to get the value and pass it to an IF block - one branch being the "Turn ON" subsystem, while the other branch being the "Turn OFF" subsystem. One more thing I'd like to mention is that we also have register read/write block - you can use those for fine grain control. For instance, here you can use it to get the PDIR register value (which if I remember correctly is the Port Data Input Register in which you find the values for the pins):

pastedImage_4.png

So to sum it up - 1 ISR block for the pin you want, using both edges as a trigger and inside the ISR subsystem you'll want to get the pin value to decide which subsystem to execute.

Please let me know if you have further problems with this.

Kind regards,

Razvan.

0 件の賞賛
返信

2,923件の閲覧回数
abhishek_kumar1
Contributor IV

Dear constantinrazvan.chivu

The option where we use GPI block and split using if else does not work somehow.

The Either Edge ISR works but somehow if else arbitration does not work. The LED does not blink at all

Best Regards

Abhishek. 

0 件の賞賛
返信

2,923件の閲覧回数
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

Can you also attach a zip with the generated code? I want to check something in the code generated at your end - there is a known bug in mathworks' code generation (for this exact scenario, with 2 subsystems called on different if branches, having inside the same blocks called - in your case both subsystems have 1 constant block and 1 GPO block). I just want to make sure that's not the problem in your case (although I suspect it is).

Kind regards,

Razvan.

0 件の賞賛
返信

2,922件の閲覧回数
abhishek_kumar1
Contributor IV

Dear constantinrazvan.chivu

Please find the attached code (and sorry for delayed response)

I tried to look in the generated code and was not able to find the function call GreenLEDOff.

This seems to be a bit weird. 

Thank you for the help.

Best Regards,

Abhishek

0 件の賞賛
返信

2,923件の閲覧回数
abhishek_kumar1
Contributor IV

Dear constantinrazvan.chivu

Was there an problems found?

Please let me know.

Best Regards,

Abhishek

0 件の賞賛
返信

2,923件の閲覧回数
constantinrazva
NXP Employee
NXP Employee

Hello Abhishek Kumar,

We have the following problem: when using the GPI ISR block and the GPI block, initialization code for only one of those is ran - we verify so that we do not initialize the same pin twice. So when you add the GPI block inside the subsystem, the ISR is no longer ran (due to lack of initialization for it). That is what is failing in your model. I will tackle this issue and come back with a fix. I will post it here so stay tuned.

Kind regards,

Razvan.

0 件の賞賛
返信

2,925件の閲覧回数
abhishek_kumar1
Contributor IV

Dear constantinrazvan.chivu

We found a temporary solution (for time bing) using the registers as shown below (model attached)

The value for the pad can be read here and we can know is it's rising or falling. 

Please let us know if you solve the code generation issue. 

pastedImage_1.png

Best Regards,

Abhishek

0 件の賞賛
返信

2,925件の閲覧回数
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

Sorry, it seems I missed the previous reply. I'll take a look and get back to you by the end of the day with an update. The GreenLEDOff subsystem is called in the external interrupt - see Interrupt_Handler_SIUL_EIRQ_00_07_IRQn.c file. 

Kind regards,

Razvan.

0 件の賞賛
返信