arduino / arduino/ArduinoCore-megaavr
DigitalWrite/TurnOffPWM interferes with alternative Timers
- Dominant language
- C++
- Stars
- 111
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
I have a program that makes heavy use of timers with PWM.
TCA-Split Timer + TCB 0/1 timers
I've changed sometimes the default PORTMUX (i.e. for the TCB timers)
When I now use a PIN with default PWM functionality (i.e. PIN3) it disables the corresponding TCB timer.
first I've changed the PINs, but now it turns out, that I quite use every available PIN on the Nano Every.
I now changed the core library to not turnoff PWM, by changing the const digital_pin_timer.
However would like to have it still in standard mode.
I've also tried to overwrite the const static digital_pin_timer with NOT_ON_TIMER (by pointer usage)
However this didn't work.
SO - do you have an idea how to prevent the timers to be disabled, when using them on different PORTMUX?
Is the only way to additionally check in the DigitalWrite(or TurnOffPWM), if the PORTMUX is the default one?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing DigitalWrite and TurnOffPWM, then inspect digital_pin_timer and the PORTMUX handling for the Nano Every's TCA-Split and TCB timers. Reproduce the interaction with an alternative PORTMUX configuration and document the expected behavior for PWM pins. Done means the timer is not unexpectedly disabled, while standard PWM behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100