Nano every timer / clock / PWM registers ?

Hello, i tried with no luck to generate some pwm signals with this library :
https://playground.arduino.cc/Code/Timer1/

Even if i check the REGISTER EMULATION ARTMEGA 328 i get the same error :

libraries/TimerOne-r11/TimerOne.cpp:51:3: error: 'TCCR1A' was not declared in this scope
/Users/lbr/Documents/Arduino/libraries/TimerOne-r11/TimerOne.cpp: In member function 'void TimerOne::initialize(long int)':
/Users/lbr/Documents/Arduino/libraries/TimerOne-r11/TimerOne.cpp:51:3: error: 'TCCR1A' was not declared in this scope
   TCCR1A = 0;                 // clear control register A
   ^~~~~~
/Users/lbr/Documents/Arduino/libraries/TimerOne-r11/TimerOne.cpp:51:3: note: suggested alternative: 'TCB1'
   TCCR1A = 0;                 // clear control register A
   ^~~~~~
   TCB1
/Users/lbr/Documents/Arduino/libraries/TimerOne-r11/TimerOne.cpp:52:3: error: 'TCCR1B' was not declared in this scope
   TCCR1B = _BV(WGM13);        // set mode 8: phase and frequency correct pwm, stop the timer
   ^~~~~~
/Users/lbr/Documents/Arduino/libraries/TimerOne-r11/TimerOne.cpp:52:3: note: suggested alternative: 'TCB1'
   TCCR1B = _BV(WGM13);        // set mode 8: phase and frequency correct pwm, stop the timer
   ^~~~~~
   TCB1

...
Erreur de compilation pour la carte Arduino Nano Every

And when i check the datasheet, i can see that there is :
– One 16-bit Timer/Counter type A (TCA) with a dedicated period register and three compare channels
– Four 16-bit Timer/Counter type B with input capture (TCB)

So i m a bit lost as i i see nowhere in the datasheet how to setup registers values to modify PWM frequencies like it is done in various exemples :

  TCCR3A = _BV(COM3C1) | _BV(WGM30);
  TCCR3B = _BV(CS30);
  TIMSK3 = _BV(TOIE3);

My final goal is to make work this script on the nano every :
https://adrianfreed.com/content/arduino-sketch-high-frequency-precision-sine-wave-tone-sound-synthesis
Which is working perfectly on my good “old” Arduino Uno board

The none working timer interrupt libraries TimerOne and TimerTwo are a big disadvantage. - TimerOne cannot be compiled, - TimerTwo will be compiled - but don't work.

Where is the solution for my problem? I'm working on a servo sketch with timeslices per interrupt to manage the servo speed. This sketch is running fine on an old NANO with TimerTwo library.

dear RudolfAtRTC,

(and everybody that is in need for a timer library for the nano every)

The Nano Every has a ATMEGA4809 processor that has different timer counters than the ATmega328P of the Uno, Mega en Nano boards.

I wrote a small library that implements control of the Timer B (TCB) of the Nano Every.

You can find it here: https://github.com/Kees-van-der-Oord/Arduino-Nano-Every-Timer-Controller-B

Copy the EveryTimerB.h/cpp and MegaAvr20MHz.h files to your sketch folder and add this code:

include "EveryTimerB.h".

void setup() { TimerB0.initialize(); TimerB0.attachInterrupt(myisr); TimerB0.setPeriod(1000000); }

void myisr() { // do something useful every second }

I hope that helps ...

WR,

Kees

Kees do you know if your Timer controller works on the 4808 on the Thinary Nano Every?