Nano every pwm library

Hello I'm very new to coding within the past year but i have been taking a few courses when I can between work and family life and I am staring to get into it to be able to create my own controllers for certain aftermarket parts and custom modify ECU code in the automotive field and I wanted to start using the nano due to its size and I have some code that I wrote that works with the PWM library for the uno found here (PWM frequency library), but unfortunately this doesn't work with the nano every due to it having the atmega 4809. I have seen there are a few options using millis and micros and a few other options but i have yet to see any where I would be able to set the PWM frequency to 12-20hz and accurately keep time.

I was wondering if anyone knows how I could get in touch with the creator of the other library since it just says system as the creator or what I would need to do to recreate the library for the nano every because keeping accurate time is important for some of the things I am trying to do. I know he got deep into reading the data sheets but I have not yet learned anywhere near this much yet, if someone is willing to help recreate this library or point me in the right direction of how to learn to do it myself that would be much appreciated, or even if I need to get quoted from someone to pay them I am open to options!

That is required. If you want to do this, you have no choice but to study the timer section of the data sheet until you understand it.

This excellent tutorial will help you to understand, in general, how AVR timers work and are used.

awesome, thank you. are there any additional courses in particular i should study as additional learing as well, or any particular topics i should pay attention to?

Come back when you have mastered the extensive material in Gammon's tutorial.

sounds good, thanks again

Here are links to the Microchip "Getting Started" documents for the A and B timers of the atmega 4609 used in the Nano Every..

https://ww1.microchip.com/downloads/en/Appnotes/TB3217-Getting-Started-with-TCA-DS90003217.pdf

https://ww1.microchip.com/downloads/en/Appnotes/TB3214-Getting-Started-with-TCB-DS90003214.pdf

There is a library you can use and look at the source to see how things are done. Available through the library manager
https://github.com/khoih-prog/megaAVR_PWM

1 Like

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