Request help for generation of short pulses on P2
Francesco Santandrea
Posts: 16
in Propeller 2
Hello everyone,
any suggestions to generate the shortest possible pulses on P2 ?
many thanks in advance
FX
Comments
The obvious code
gives a 2 cycle pulse, which is plenty short.
Then of course there's the appropriately named P_PULSE smart pin mode, which can create pulses of any length. So to create a 1 cycle pulse:
The pulse length is Y*X[15:0] and another pulse can be created by doing another WYPIN
Is there a way to create a sub cycle pulse? Seems like maybe some trickery with clocked and unclocked pins and some of the smart modes might allow this?
A C and a R might do the trick?
Sounds more like a glitch if it's sub cycle. I vaguely remember a fix put in where there was once some race condition in the P2 between changing the pin's direction control and the pin state at the same time. It might have been during the respin.
UPDATE: found it... https://forums.parallax.com/discussion/comment/1448595/#Comment_1448595
Thanks Wuerfel_21 and everyone for the suggestions,
at the moment I used code below obtaining pulses of about 5-6 ns with a repetition frequency of about 11.25 MHz,
It would be interesting to apply the tricks for shorter pulses, so I ask further help and example codes
DEBUG
relaunching the code after an EVAL P2 off, it doesn't work,
so I made this fix:
and now repetition frequency increase at 45 MHz
Yes, definitely want the #
Surprised it worked without it…
I think FlexProp will give you a warning if you make that mistake but prop tool does not
if you want the fastest repeating pulse, try this (in Spin):
pinstart(1, P_NCO_DUTY|P_OE, 1, 1<<31)
Wuerfel_21
YES! 180 MHz
in fact it is not clear,
I was testing variuos code in Spin2 and PASM, probably Propeller Tool had changed some registers that made the code work without the #
Notes
in all measurements I used a 10x attenuated probe, I only just noticed that I set correctly the probe only on the
first two oscillograms, so the vertical signals amplitudes of the last two oscillograms shown must be multiplied by 10
At theese frequencies the quality of the probe, cable and analog frontend of the scope becomes important. Most scopes even with 500MS/s do not display the waveform of a 5ns pulse correctly. To distinguish between a 5ns square pulse and something like a sine half-wave you need at least a true bandwidth of the 5th overtone = 100MHz * 5 = 500MHz.
You can always make the pulse narrower by a high pass filter followed by a schmitt trigger. But you need a high driver strength, a good layout and matched cable impedances.
What is the application?
certainly, at the moment I am using an oscilloscope with a bandwidth of 200 MHz 500 MS/s, probes have a bandwidth of 250 MHz (in the 10x position) and rise time of 1.4 ns
I agree, I know well because and already I used this tecnique
Sure, respecting the transmission line impedance and load is highly recommended
Various research