Repeatability of output pulse timing using hardware timers

Wrong use of oscilloscope for this measurement.
You are measuring a pulse that is only 8us past the trigger point.
Only 128 cycles have passed at 16MHz and jitter is invisible.
We are measuring the timing of the pulse that occurs 100ms after the trigger point.
There, 1600000 cycles have passed at 16MHz, and the jitter increases due to accumulation.
Please see the attached image.

Of course I know.
But I use when I think necessary and sufficient for this test method.

Okay, I understand. May ask what you have set how on the oscilloscope to measure that so?

Set the measurement property same the image you uploaded post before.
Change the timescale to 10ms/div, dial to move trace point around 100ms.
Change the timescale to a smaller size and enlarge trace.
Observe the pulse that appears around 100ms.
That is the "second" pulse that appears 100ms after the trigger point.
Yeah, Appearance of jitter. :blush:

Thank you. Now I get it. The trigger point is outside the screen. Now the pulse wanders with me too.

Oh, nice work.
You're becoming more and more proficient in oscilloscopes! :+1:

And we got the recognition... " The power of Xtal. " :grinning:

Yeah. :grinning:

I have now tried this with an AVR128DB48, which is related to the megaAVR0 series. The Curiosity Nano board has a crystal onboard, so I can test between crystal and internal RC.
Internal RC produces 90µs bandwidth jitter.
With crystal nothing measurable.
Measuring time always greater than 3min.
Really cool thing and nice cooperation. :+1:

You need a crystal for your project. :rofl:


For clarity, I just want to say that the Uno board uses a ceramic resonator - 16 MHz ceramic resonator (CSTCE16M0V53-R0). The crystal oscillator on the board is apparently used for the USB interface. The Nano apparently has a crystal, and the Nano Every has neither as the 4809 doesn't support it (32 kHz crystal or external clock only). Maybe I should have moved to the Nano!

"Nano Every" don't fit to Every project.

Nano "the Not Every" is suitable for this project.

LMAO :rofl:

A crystal oscillator would generate the square wave clock. A "normal" crystal does not work. The second connection is missing.

If the µC should only generate this one PWM, then build yourself a board with crystal oscillator and a smaller ATtiny or Atmega3209 or 4808 ...

Huh. I wouldn’t think that an internal RC clock would be more prone to jitter than anything else...

You could program the chip to output the clock, or any timer output, and look for jitter there as well - if it’s really due to the clock source, it should display the same sort of jitter (percentage-wise), right?

I was just as surprised! I assumed the spec was more about bias in the clock frequency and long-term drift with things like temperature, but I'm definitely measuring a big difference between the Nano Every and the Uno. See post #4 above for code I ran outputting PWM from the hardware timer TCB1.

Looks like you can directly output the clock on PA7, but that's not broken out on the Nano Every board. Maybe someone with a bare 4809 (or good probing skills) can test that.

Hi,

TCA0 uses its WO pin. Any other influences are thus excluded. Only the clock has an influence on it.

If you use TCBn with interrupts, the interrupt jitter is added. The WO pins of TCB0 and TCB1 are available on PF4 and PF5. For this the PortMux register must be used.


  Arduino Nano Every PinOut (ATmega4809)
                  _
               __|_|__    
              |       |  
  (D13)  PE2  +       +  PE1  (D12)  
        3.3V  +       +  PE0  (D11)  
  (AREF) PD7  +       +  PB1  (D10)(~)(TCA0 Channel 1)
  (D14)  PD3  +       +  PB0  (D 9)(~)(TCA0 Channel 0)
  (D15)  PD2  +       +  PE3  (D 8)
  (D16)  PD1  +       +  PA1  (D 7) 
  (D17)  PD0  +       +  PF4  (D 6)(~)(TCB0)
  (D18)  PF2  +       +  PB2  (D 5)(~)(TCA0 Channel 2)
  (D19)  PF3  +       +  PC6  (D 4)  
  (D20)  PD4  +       +  PF5  (D 3)(~)(TCB1)  
  (D21)  PD5  +       +  PA0  (D 2) 
        5.0V  +       +  GND
       RESET  +       +  RESET
         GND  +       +  PC5  (D 0) RX1
         VIN  +       +  PC4  (D 1) TX1      
              |_______|  


 Ardu      |    Event       |      CCL-LUTn     |       TCA0        |       TCBn        |
  Pin Port | Port | Channel | default | PortMux | default | PortMux | default | PortMux |
   0  PC5  |  0     2 or 3  |   ---       ---   |   ---      0-WO5  |   ---       ---   |
   1  PC4  |  0     2 or 3  |   ---       ---   |   ---      0-WO4  |   ---       ---   |
   2  PA0  |  0     0 or 1  |  0-IN0      ---   |  0-WO0      ---   |   ---       ---   |
   3  PF5  |  1     4 or 5  |   ---       ---   |   ---      0-WO5  |   ---      1-WO   |
   4  PC6  |  0     2 or 3  |   ---      1-OUT  |   ---       ---   |   ---       ---   |
   5  PB2  |  1     0 or 1  |   ---       ---   |   ---      0-WO2  |   ---       ---   |
   6  PF4  |  1     4 or 5  |   ---       ---   |   ---      0-WO4  |   ---      0-WO   |
   7  PA1  |  0     0 or 1  |  0-IN1      ---   |  0-WO1      ---   |   ---       ---   |
   8  PE3  |  0     4 or 5  |   ---       ---   |   ---      0-WO3  |   ---       ---   |
   9  PB0  |  1     0 or 1  |   ---       ---   |   ---      0-WO0  |   ---       ---   |
  10  PB1  |  1     0 or 1  |   ---       ---   |   ---      0-WO1  |   ---       ---   |
  11  PE0  |  0     4 or 5  |   ---       ---   |   ---      0-WO0  |   ---       ---   |
  12  PE1  |  0     4 or 5  |   ---       ---   |   ---      0-WO1  |   ---       ---   |
  13  PE2  |  0     4 or 5  |   ---       ---   |   ---      0-WO2  |   ---       ---   |
  14  PD3  |  1     2 or 3  |  2-OUT      ---   |   ---      0-WO3  |   ---       ---   |
  15  PD2  |  1     2 or 3  |  2-IN2      ---   |   ---      0-WO2  |   ---       ---   |
  16  PD1  |  1     2 or 3  |  2-IN1      ---   |   ---      0-WO1  |   ---       ---   |
  17  PD0  |  1     2 or 3  |  2-IN0      ---   |   ---      0-WO0  |   ---       ---   |
  18  PF2  |  1     4 or 5  |  3-IN2      ---   |   ---      0-WO2  |   ---       ---   |  Doppelbelegung mit PA2 beachten !!!
  19  PF3  |  1     4 or 5  |  3-OUT      ---   |   ---      0-WO3  |   ---       ---   |  Doppelbelegung mit PA3 beachten !!!
  20  PD4  |  1     2 or 3  |   ---       ---   |   ---      0-WO4  |   ---       ---   |
  21  PD5  |  1     2 or 3  |   ---       ---   |   ---      0-WO5  |   ---       ---   |

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.