Inverse hardware PWM pair with nano every

  • I need a PWM and its inverse to control a H bridge.
  • The switching frequency must be beyond human hearing range. So software PWM is out of question.
  • After reading the manual, either TCA or TCB offers inverted output.
  • CCL seem to be the right way to go but I'm rather unfamiliar with CCL.
  • I don't want to use external NOT gate if the MCU can handle it.

Any help is much appreciated !

Consider making 100% = zero and 0 = 100% by using the map function.

You might want to consider one of the new chips that has a TCD timer, like the ATtiny3217 (supported by DrAzzy's ATtinyCore.)

The CCL feature in the ATmega4809 can be used to provide complementary outputs of a Timer/Counter output. LUT0 or LUT3 outputs to A5 and LUT2 outputs to A0. LUT inputs can come from any of the Timer/Counter outputs and by setting the Truth Table registers you can have one LUT invert and the other non-inverting.

Using the invert output with the Timer/Counter would mean you would have to use two channels, which might give you some nasty problems if the phase isn't 180ยบ.

As an alternative, the ARM-based Arduino boards (Due, Zero, MKR series) have complementary output PWM channels. I don't know if the necessary microcontroller pins are brought out on the Arduino boards. You would have to check.

Hi,

the timers themselves have no invert function in that sense. But you can easily solve this by configuring the INVEN bit in the PORT.PINnCTRL register accordingly. Manual 16.4.