Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Support 6-channel PWM with only TC4 on ATmega32u4 #294

Open
cinderblock opened this issue Jul 19, 2023 · 4 comments
Open

[FEATURE] Support 6-channel PWM with only TC4 on ATmega32u4 #294

cinderblock opened this issue Jul 19, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@cinderblock
Copy link

I'd like to use some existing ATmega32u4 based driver boards. Theses are wired up to the 6-channel PWM output that is unique to the ATmega32u4's 10-bit High Speed Timer/Counter4.

AVR Pin Output Compare Arduino Pin
PC7 OC4A D13
PC6 OC4A~ D5
PB6 OC4B D10
PB5 OC4B~ D9
PD7 OC4D D6
PD6 OC4D~ D12

Looking at the sources in atmega32u4_mcu.cpp, it's clear that the code is only set up for a couple dedicated pins that don't fully overlap with the Timer 4 hardware outputs.

I realize this is an older IC but is there any interest in supporting this mode?

My very old implementation: https://github.com/cinderblock/3-Phase-Controller/blob/master/src/ThreePhase/Driver.cpp


PS, great to meet you at OpenSauce!

@cinderblock cinderblock added the enhancement New feature or request label Jul 19, 2023
@askuric
Copy link
Member

askuric commented Jul 19, 2023

Hey, this could be a nice addition, would you be interested to do a PR for this?

@cinderblock
Copy link
Author

Yes, I'm interested. But I won't have time to look much at this for the next 2, maybe 6+ weeks! (Moving offices, Burning Man, traveling to a wedding) So if anyone else wants to get started, be my guest!


To be sure, would this (new) code live in this repo or in the drivers repo?

@runger1101001
Copy link
Member

From my point of view it would be one of the PWM drivers in the main repository, or a modification to one of the existing AVR drivers…

@askuric
Copy link
Member

askuric commented Jul 20, 2023

Yep, I agree. This would go the the main library inside the file atmega32u4_mcu.cpp.
I am going to try to provide you with a starting point @cinderblock, maybe even implement it completely, if I manage to get the time. Otherwise, don't hesitate to contact us when you start implementing it if you need some assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants