Lots of new controllers out now, need fast switching

With so many new models of Arduino and other brands I am wondering if any will fit my application.
I need to control a digital output pin On then Off for 100 nanoseconds.
Doing this with my Arduino Nano (write On, no delay, then Off) it will give me a nice 4us pulse.
Are there any controllers that can do this in 100 ns?

I was looking into Pi Zero that runs at 1 GHz but it uses a Linux Op system which probably will slow
it way down. Is that true?
Thanks.

Try it with direct port manipulation:

void setup(){
pinMode (2, OUTPUT);
}
void loop(){
while (1){ // should help reduce "jitter" if watching on a scope
PIND = PIND | 0b00000100; // toggle D2 by writing to Input port
PIND = PIND | 0b00000100; // toggle D2 by writing to Input port
delayMicroseconds (100); // or something so you can see the pulse
}
}

Doing this with my Arduino Nano (write On, no delay, then Off) it will give me a nice 4us pulse.
Are there any controllers that can do this in 100 ns?

Using digitalWrite()? You can probably get down to about 125 to 250ns using direct port writes on AVR. For such short pulses, you should probably use one of the Timer modules, which are designed for such things. But with a 16MHz clock, you'll always be some multiple of 62.5ns - one of the chips with a PLL for the timer clock (tiny85, I think) should be able to get closer (64MHz peripheral clock.) I don't think there is a timer library that makes it easy to generate such short pulses, though, so you'd have to dig into things.

Could clock it off a 20mhz crystal to get 50ns resolution with the timers - or use the Tiny85, Tiny861, or Atmega64M1 (though I'm not sure how mature the core for the latter is) for the high speed timer.

Or use a timer or direct port manipulation on one of the faster Arduinos (eg Due, 101, or something like teensy).

Which makes more sense depends on the rest of your project - but no matter what, you're taking over a timer (or using direct port manipulation). digitalWrite() is a rather slow way to change a pin.

Thanks for the suggestions about using direct port write. I did not know that would be any faster than the digitalWrite command. How much faster is it? Guess I'll have to try that out.
Also, how do I use the timer to switch a port on and off any faster?

How much faster is it?

About 20x faster, if the pin and the values you're writing are constants

how do I use the timer to switch a port on and off any faster?

Set the timer clock to max, set the output compare register(s) small values away (from start, from stop, or from each other), and let it rip. You should be able to get pulses as small as one clock, I think. (Getting an exact start time might be a different issue, since the setup overhead of the timer is "large" compared to the instructions to just toggle bits, so this is best for things of the form "I need a short pulse anytime within the next longish period." Although you may be able to do fancier things as well.)

Thanks Westfw! All great info that I did not know. I had no way to find out these subtle tricks.

Looking around at other controllers I see that the Teensy 3.2 can be continuously overclocked at 96 MHz. without harm. Can it use the same direct port write commands that Arduino IDE allows?

pyroartist:
Looking around at other controllers I see that the Teensy 3.2 can be continuously overclocked at 96 MHz. without harm. Can it use the same direct port write commands that Arduino IDE allows?

Direct port writing is raw C, nothing specific to the IDE. It's stuff like digitalWrite() that's specific to Arduino (though anything supported in the Arduino IDE is going to have functions like that).

Direct port write is possible on almost any microcontroller.
The register names will be different, and they may be different sizes (I think they're 16 bit registers, instead of 8, and the naming scheme is different). Consult the datasheet for the chip used in the Teensy3.2 for more details.

Thanks Dr. Azzy, got it! So what we are doing is essentially inserting the native machine language code into the C program to control the port.