Arduino that can eat 10MHz

Is there an Arduino that can clock 10MHz on a timer1 pin (ICR1)? I don't want to switch to an STM or something similar now.

Have a look at this discussion: https://forum.arduino.cc/index.php?topic=716118.0

If you can clock an Arduino at 10MHz (instead of 16MHz), then you can output the system clock on one of the port pins.

On a 5V Arduino, you could swap out the resonator or crystal to get 10 Mhz. The bootloader and Arduino core (boards.txt) would have to be modified for serial port program upload.

Sorry, you get me wrong. I want to count an external 10 MHz signal via a pin with hardware Timer1.

I think the short answer is NO.

The longer answer from the datasheet, section 17.3 - External Clock Source:
Each half period of the external clock applied must be longer than one system clock cycle to ensure correct
sampling. The external clock must be ensured to have less than half the system clock frequency (fExtClk < fclk_io/2) given a 50/50% duty cycle. Since the edge detector uses sampling, the maximum frequency of an
external clock it can detect is half the sampling frequency (Nyquist sampling theorem). However, due to
variation of the system clock frequency and duty cycle caused by Oscillator source (crystal, resonator, and
capacitors) tolerances, it is recommended that maximum frequency of an external clock source is less than
fclk_io/2.5.

The ESP32 has a PCNT module that operates independently of the CPU that can measure/count pulses up to 80Mhz/12.5nS.

The PCNT is accessible through the ESP32 Pulse Counter API: Pulse Counter - ESP32 - — ESP-IDF Programming Guide latest documentation

I want to count an external 10 MHz signal via a pin with hardware Timer1.

No problem at all. For a standard AVR based Arduino, the MCU data sheet gives the details.

I don't think you can clock Timer1 off external 10 MHz source as noted above on a classic AVR.

on tinyAVR 1-series, there's at least one way (pipe it to external clock pin while chip is still running off internal, take over TCD0 and clock that from external clock; use capture and/or interrupts on TCD0 to see current count, detect periodic overflows for average clock speed, and so on.), and on AVR Dx-series and upcoming tinyAVR 2-series, you can do it on any old TCB via clock on event, maybe even without clocking the chip at 20/24 MHz...

Keep in mind that on my core the tinyAVR 1-series defaults to using TCD0 for millis (since it's the one people are least likely to use). Configuring that timer is a real adventure, it's a totally different animal than the normal timers (not to mention the old fashioned timers on the legacy/classic AVRs.

I don't think you can clock Timer1 off external 10 MHz source as noted above on a classic AVR.

This is what ATmega328 data sheet states. Worth reading!

17.3 External Clock Source
An external clock source applied to the T1/T0 pin can be used as Timer/Counter clock
(clkT1/clkT0). The T1/T0 pin is sampled once every system clock cycle by the pin synchronization
logic. The synchronized (sampled) signal is then passed through the edge detector. Figure 17-1
shows a functional equivalent block diagram of the T1/T0 synchronization and edge detector
logic. The registers are clocked at the positive edge of the internal system clock (clkI/O). The latch
is transparent in the high period of the internal system clock.
The edge detector generates one clkT1/clkT0 pulse for each positive (CSn2:0 = 7) or negative
(CSn2:0 = 6) edge it detects.

Given the synchronization with the system clock, the maximum external clock frequency is (F_CPU)/2, so you have to use a 20 MHz or higher CPU clock crystal in order for Timer1 to be externally clocked at 10 MHz. People have reported running ATmega328s for long periods at over 30 MHz with no issues.

jremington:
This is what ATmega328 data sheet states. Worth reading!

Given the synchronization with the system clock, the maximum external clock frequency is (F_CPU)/2, so you have to use a 20 MHz or higher CPU clock crystal in order for Timer1 to be externally clocked at 10 MHz. People have reported running ATmega328s for long periods at over 30 MHz with no issues.

Interesting! Nevertheless here comes the Nyquist citeria into play. I think I need a uC with at least 20MHz/25MHz or higher . Maybe a STM32 Bluepill. But I fear some libs won’t run on that platform without intervention.

The arduino DUE Timers Counters can be clocked by an external clock, provided this external clock be at least 2.5 times lower than the peripheral clock. For Timer Counters, the peripheral clock is 42MHz (42 MHz/ 2.5 = 16.8 MHz).

Well, the reason I mentioned TCD was that it is async, nyquist criteria are irrelevant. The price for that is the synchronization process described in datasheet.

But - I just saw something that gave me pause. OP mentions ICR1 - input capture, not external clock.

OP, what are you trying to do?

I meant ICR1-input capture at a rate of 10 MHz. Sorry for being imprecise.

"input capture at a rate of 10 MHz" makes no sense.

WHAT are you trying to do? Please state it as clearly as possible.

I can't see the problem with understanding that. Consider it a frequency counter. Having said that I don't think a micro running at 16MHz would be able to do it.

If you are intending to use the input capture system, are you measuring each mark and each space of a wave form and to what degree of precision? At 10 MHz, with a 50% duty cycle, that is 50ns for each flank! Since one CPU tick takes 62.5ns (16 MHz) you begin to see a problem.
The main point of the input capture system is that the timings of the selected edges are captured in hardware, but you still need some capacity to process the results.

windoze_killa:
I can't see the problem with understanding that. Consider it a frequency counter. Having said that I don't think a micro running at 16MHz would be able to do it.

That will be correct. Only I don't understand because the timer capture comes from the hardware pin and not from the CPU clock.

If you are building a frequency counter on the limits of what can be supported by a standard MCU, consider also an approach using an external prescaler. Here are some examples I found recently:

Edit

rsardu:
That will be correct. Only I don't understand because the timer capture comes from the hardware pin and not from the CPU clock.

When an edge (pre-selected rising or falling) is detected on the input capture pin ICP1, the current count of the timer1 is immediately stored, by hardware, in the register ICR1.

Your problem is this. At 10MHz you will see only a difference of 1 or 2 CPU clocks between each measurement with the prescaler set at 1. You can't do much with that. You could not even do anything in the ISR because there would not be enough time to enter it.

The only thing you might be able to do is to clock one timer with your 10MHz signal and gate it with another timer so you would have a measure of pulses within a unit of time, from which you would calculate frequency. If your gating interval is more than about 4ms (for a 16bit timer), you start having to handle overflows of the timer registers.

@6v6gt +1

I think something like this would be useful. Just externally divide your signal by 2, or if using the tinyAVR 0/1/2 series chips you could do this with its internal configurable logic. By gating the signal over time, you'll gain back precision/resolution in your readings. I mean, do you really need to take 10 million measurements per second?

EDIT: A nice side effect of using divide by 2 is you'll get a true square wave (50% duty cycle).

rsardu:
That will be correct. Only I don't understand because the timer capture comes from the hardware pin and not from the CPU clock.

Do you understand how a micro (or any computer for that matter) works. Data is placed on data lines and then clocked into registers, ALUs and other bits of the micro. Virtually nothing happens without a clock cycle.

To read the frequency of data on a pin you count the number of cycles of that data within a selected time period (good use of a timer). The micro needs to fast enough to be able to clock the timer and count the number of clock cycles between highs or lows on the input. I am not sure how the inner working of an AVR works but there are other things going on at the same time so with a clock frequency barely 50% faster than the signal you are trying to read you're not going to have much success. Even with a micro running at 32MHz I still think there will be problems.

As suggested a pre-scaler would be your best bet if you are sticking with a basic AVR.