Rootin Tootin Fast Pulse Shootin

Status
Not open for further replies.

TelephoneBill

Well-known member
Playing with the Teensy 3.2 today, I wondered what would be the fastest output pulse that I could generate.

Using "120 MHz overclock" and initialising with "pinModeFast(23, OUTPUT)", the following code...

digitalWriteFast(23, 1); //set pin 23 high
digitalWriteFast(23, 0); //set pin 23 low

... produced this scope display on single shot (load = x10 probe only)...

FastestPulse01.jpg

Can't guarantee the amplitude calibration, but the pulse duration is impressive.

(for more info on pinModeFast see - https://forum.pjrc.com/threads/2873...ed-on-Teensy-3-1?p=75044&viewfull=1#post75044)
 
To find a comparison, I made the following breadboard circuit and found that it gave a very similar 5 nS pulse shape to T3.6...

Pulse02a.jpg Pulse02b.jpg

I now suspect that the actual risetime is much faster than shown in the scope pictures (and being limited by the scope itself). Perhaps someone with a faster scope might investigate. The breadboard circuit relies on the avalanche breakdown of the base/collector junction to produce the pulse. The coax cable has a capacitance of about 25 pF.

Its worth noting that if a beam of light entered your room window at exactly the same time as the rising edge, then the falling edge could occur before the light beam hit the carpet :) !!
 
3.8 ns pulse width, that's pretty fast!
It looks like Table 2.3.2 General switching specifications on p.18 of https://www.pjrc.com/teensy/K66P144M180SF5V2.pdf says the shortest guaranteed valid INPUT pulse on a GPIO pin is more than 10x longer, at 50 nsec.
Although maybe I'm misreading that, as it would imply you can't receive data faster than 10 MHz at 50% duty cycle and I don't think that's true.
 
Try this with 240MHz (Optimize "Faster") and be amazed .. :)
Code:
void pinModeFast(uint8_t pin, uint8_t mode)
{
  volatile uint32_t *config;

  if (pin >= CORE_NUM_DIGITAL) return;
  config = portConfigRegister(pin);

  if (mode == OUTPUT) {
#ifdef KINETISK
    *portModeRegister(pin) = 1;
#else
    *portModeRegister(pin) |= digitalPinToBitMask(pin); // TODO: atomic
#endif
    *config = PORT_PCR_DSE | PORT_PCR_MUX(1); // SRE bit = 0 for fast slew rate
  } else {
#ifdef KINETISK
    *portModeRegister(pin) = 0;
#else
    *portModeRegister(pin) &= ~digitalPinToBitMask(pin);
#endif
    if (mode == INPUT) {
      *config = PORT_PCR_MUX(1);
    } else {
      *config = PORT_PCR_MUX(1) | PORT_PCR_PE | PORT_PCR_PS; // pullup
    }
  }
}

void setup() {

pinModeFast(23, OUTPUT);

}

void loop() {

digitalWriteFast(23, 1); //set pin 23 high
digitalWriteFast(23, 0); //set pin 23 low
// asm volatile ("nop");
int x = digitalReadFast(23); // <- be amazed!
Serial.println(x);
delay(200);
}

Output is :
Code:
0
1
1
1
1
0
0
0
1
1
1
1
1
0
1
1
0
0
1
0
0
1
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
1
1
0
0
1
1
0
0
0
0
1
1
0
0
1
0
1
1
1
0
1
0
0
1
1
0
0
1
0
0
1
0
1
0
1
1
0
1
0
1
0
1
1
0
1
0
0
1
1
0
0
0
1
0
1
0
1
1
1
0
1
1
0
1
1
0
0
1
1
1
1
0
1
1
1
1
0
1
0
1
0
1
0
0
1
0
1
0
1
1
0
0

Edit: use (Optimize "Faster")

Edit: Due to this effect, I've had a problem when trying to read very fast 4-bit parallel from a flash-chip (toggled a pin als "clk"-signal in assembler - I had to insert some "nop", which slowed down it drastically)
 

Attachments

  • pinModeFast.ino.zip
    15.1 KB · Views: 80
Last edited:
130 volts, really?

Yes, you read that correctly - "+130 volts". It doesn't work with a lower rail at +120 volts (at least with my transistor).

What the circuit relies on is stripping an electron out of the valence band (into the conduction band) which then crashes into another atom and knocking out two. Two becomes four. Four becomes eight... and... you get the idea of the "avalanche". Its a bit like a photomultiplier without the photon. The saving grace is the fact that the discharge then lowers the voltage pretty quickly.

This avalanche is one of the fastest ways of creating a "switch" with a BJT. Once the cascade is over, then the collector/base junction goes back into normal depletion mode, until the voltage rises again to start another avalanche several microsecs later. Its why I am convinced that the T3.6 signal is being limited by my scope (and your later snapshot confirms - your signal has a square-ish look).
 
The pulse interval is around 5.3 uSec (189 KHz) but a little shaky because the trigger level depends on ambient temperature (thermal energy of an atom being stripped to start the cascade)...

Pulse02c.jpg

The circuit is interesting. The transistor base is normally switched off (does it ever actually turn on?). The emitter voltage rises because the avalanche drags current up through the emitter/base junction. And you can control the size of the pulse via the emitter resistance.

When first powered on, the capacitance of the coax inner is not charged (so is zero volts - and the collector too). This capacitance charges on the traditional exponential curve through the 100K resistor, until the electric stress across collector/base is sufficient to start the avalanche. Then the capacitance is rapidly discharged and you get the pulse in the emitter resistor. I guess this is on the faster C x 56R time constant (1.4 nS). If the R was smaller, then we would be talking picoSecs.

An idea has just occurred to me. The base could be controlled by a Teensy output pin. If switched on (default), then the transistor collector would saturate, drawing about 1.3 uA through 100K (and be in the voltage safe region). When the Teensy pin went low, then the transistor base would turn off and allow the pulse to happen some uSecs later. It may be prudent to protect the pin via a 3v3 zener. But this could generate an even faster pulse than one clock cycle - useful for experiments.

BTW, Paul's rise time is about 1.3 nS. The bandwidth is normally calculated by B.W. = 0.4 / T (where T is 10/90 edge timing). This gives Paul's scope a B.W. of about 307 MHz actual I conclude.
 
Theoretically speaking, can you make an accurate measure of risetime when you have only a very short pulse, rather than a step? I think it might require additional assumptions like single-pole rolloff behavior. At the frequency limit of the scope, with the probe assembly and the scope internals as well, there might not be a dominant single pole (?)
 
I made that measurement in msg #7 using the scope probe tip (no convenient clip) right at pin 0 and a very short piece of wire right from the probe's shield near the tip to the GND pin. While awkwardly holding the probe and ground wire with both hands, I had to get someone to help press the scope's screenshot button (actually the "quick action" button which I have configured to email me the screenshot).

Using the normal ground lead and probe clip caused a terrible measurement with a lot more ringing. Even with only ~200 MHz bandwidth, any extra wire length makes a pretty noticeable difference.

Sadly, PJRC just doesn't have the budget for a 500 MHz upgrade (fastest possible using my N2894A probes which supposedly have 700 MHz bandwidth), and certainly not the 1 GHz upgrade or 1.5 GHz upgrade, which would also require buying very expensive active probes.

Unless someone with this sort of insanely expensive gear happens to come along, I guess we're just going to have to use our imagination to guess what that pulse really looks like. :(
 
Status
Not open for further replies.
Back
Top