Simple Trigger Based on External Signal

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

Simple Trigger Based on External Signal

1,599件の閲覧回数
r0oland
Contributor III

I have been working on this for a long time now and I am not able to do a seemingly simple thing:

Short Version of Problem:

- upon external trigger create output trigger with little to no jitter 

Detailed Problem:

I have an external trigger signal on an input pin. I do not know when this trigger will appear in time, can be after a second, can be after 100 microseconds, could be after a day...

I thus want to setup my system to react to this trigger, do other things while waiting for the trigger and once the external trigger arrives I want to generate multiple output trigger signals with different timings but all in sync. 

The jitter between external input trigger and output signals which I create must have minimal jitter, ideally less than 100 ns. 

My approach (simplified) - PWM based:

- setup PWM1 with the correct timings (i.e. setup clock, VALx registers etc)

- setup PWM for external sync via the external trigger pin (via XBAR)

- also setup the PWM fault signal to use the same external signal (also via XBAR)

- start the PWM system and wait for trigger, since the fault signal is not activated no PWM signals are generated

- upon receiving an external trigger, the external sync resets the PWM system and the fault is deactivated, thus the PWM signal is output exactly where and when I need it. 

I pat myself on the back for a job well done, BUT then I notice that once in a blue moon my trigger output is not correct. 

The fault signal does not disable the PWM system running but simply disables the PWM output. Thus the PWM counts in the background, overflows every 0xFFF ticks and thus switches the internal PWM signal On / Off. If the PWM system is already in the on state when I get an external trigger, it seems the reset is not working as expected. Instead, the signal simply stays active until the VAL3 | VAL5 compare is reached at which point the PWM system goes back to correct operation...

See attached examples of good and bad triggers (blue is the input, green is one of the outputs).

 

What is going on here? And is there a better way to solve this, as I am now convinced the PWM system is not the best approach...

 

 

 

ラベル(5)
タグ(2)
0 件の賞賛
返信
4 返答(返信)

1,541件の閲覧回数
mjbcswitzerland
Specialist V

Hi

Consider also the use of the XBAR (for interrupt, direct logic connection and/or DMA).
This video shows some of the capabilities: https://www.youtube.com/watch?v=zNWIG-O7ZW0&list=PLWKlVb_MqDQEOCnsNOJO8gd3jDCwiyKKe&index=6

Regards

Mark (uTasker project lead)


For our discounted i.MX and Kinetis stock availability see https://www.utasker.com/Shop/semi.html

0 件の賞賛
返信

1,536件の閲覧回数
r0oland
Contributor III

Dear Mark,

as written in my problem description, I am already using the XBAR system to connect the external trigger to the PWM system. In fact, I am using multiple connections to the fault and external sync inputs of the PWM. 

I believe this is where the problem originates:

The external trigger (via XBAR) causes both an init of the PWM via external sync AND the PWM output is enabled via the cleared fault signal. Here the order matters, and it appears the fault is cleared first and the init is done after, causing the PWM system to stay enabled while it should be disabled following an external signal. 

0 件の賞賛
返信

1,527件の閲覧回数
mjbcswitzerland
Specialist V

Hi

I am sorry, I had only a moment to write something and I didn't study all of the details you had given.
It sounds as though there is a race state when using two XBAR paths - may be you could pass one of them through the AOI module to either add an inherent HW delay or to combine it with a separate timing control in order to ensure the order?

Regards

Mark

 

0 件の賞賛
返信

1,549件の閲覧回数
_Leo_
NXP TechSupport
NXP TechSupport

Thank you so much for your interest in our products and for using our community.

I noticed that you have another similar case, so I will follow up on this last one that I mention.

Have a nice day!

0 件の賞賛
返信