PWM phase correct 10 bit with 2 timers (timer0 and timer 2).

Hi, i need to use pwm control for 4 devices. I've used phase correct pwm mode from timer/counter1 to get low frequency (~8Hz). But unfortunately it is possible only for timer/counter 1, which has 2 outputs. I need to get this frequency for another 2 devices. Is there any possibility to make 10 bit PWM phase correct control by using 2 x 8 bits timers (timer 0 and timer 1)?

The following diagram says that every TC of ATmega328P has two programmable PWM channels.
pwm.png

pwm.png

No, you cant get 10-bit hardware pwm with an atmega328 on more than 2 channels. You cant turn two 8 bit timers into a 10-bit timer, not if you want hardware pwm. Howver you can:

Use a different chip with 2 16-bit timers (attiny841 (use my core), atmega328pb (use minicore), atmega 1284p (use mightycore), atmega2560 (arduino mega), or atmega2561(use megacore)

The smaller flash versions of above will also work.

At only 8hz, you might be able to do it in software

Or you could use a non-AVR chip

ATmega328pb does some odd things with the pwm from Timer3, and Timer4. I have started to look more at ATmega324pb, which has three 16bit timers (Timer1, Timer3, Timer4) with A and B output compare registers.

if ATmega324pb then GitHub - MCUdude/MightyCore: Arduino hardware package for ATmega1284, ATmega644, ATmega324, ATmega324PB, ATmega164, ATmega32, ATmega16 and ATmega8535

if ATmega328pb then GitHub - MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB

It puts oc3b and oc4b on the same pin, so there is one fewer pwm pins available - but thats the only "weird" thing it does with the pwm. Unless you enable the oc modulation mode, of course. But iirc the atmega2560 has the same thing

DrAzzy:
Use a different chip with 2 16-bit timers (attiny841 (use my core), atmega328pb (use minicore), atmega 1284p (use mightycore), atmega2560 (arduino mega), or atmega2561(use megacore)

Or a 32U4 based board.