-
Notifications
You must be signed in to change notification settings - Fork 143
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
STM32G4: modm interface hides some of Timer features #1011
Labels
Milestone
Comments
ser-plu
changed the title
STM32G4: Interface hides some of Timer features
STM32G4: modm interface hides some of Timer features
May 2, 2023
Do you want to propose a fix? |
I just ran into the same issue; hacky workaround is: using Timer = Timer1;
Timer::enable();
Timer::setMode(Timer::Mode::UpCounter);
// Timer clock: APB2 timer clock (170MHz)
Timer::setPrescaler(10);
// Prescaler: 1 -> Timer counter frequency: 170MHz
Timer::setOverflow(4250);
// Pwm frequency: 170MHz / 4250 / 10 = 4kHz
// configureOutputChannel for ChXn channels does not work
// Timer::configureOutputChannel<GpioC13::Ch1n>(Timer::OutputCompareMode::Pwm, 0);
// However, the configure output channel with Ch1 pin disabled works as expected
Timer::configureOutputChannel(1,
Timer::OutputCompareMode::Pwm,
Timer::PinState::Disable, // disable Ch1 output
Timer::OutputComparePolarity::ActiveHigh, // this doesn't matter
Timer::PinState::Enable, // enable Ch1n output
Timer::OutputComparePolarity::ActiveHigh, // OutputComparePolarity for Ch1n
Timer::OutputComparePreload::Disable
);
Timer::applyAndReset();
Timer::setCompareValue(1,0);
Timer::applyAndReset();
Timer::pause();
Timer::enableOutput();
Timer::connect<GpioC13::Ch1n>(); // it works to just connect the Ch1n channel
Timer::start(); |
This has been fixed, right? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
configureOutputChannel
function from simple timers (cannot enable the complementary channel).configureOutputChannel
fromAdvancedControlTimer
is more appropriate. There could be also more similarities between the timers.GeneralPurposeTimer::signalToChannel
does not work with complementary channels.Need to add
|| Signal::Signal == Gpio::Signal::Ch1n
to every if check.The text was updated successfully, but these errors were encountered: