atmel-samd: turn off timer clocks after both timers sharing a GCLK channel are free
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 56/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- c
- Domaine
- embedded-iot
Piste de recherche
Start with timer_handler.c and inspect tc_gclk_ids[], tcc_gclk_ids[], and the timer allocation and release paths. Read the linked issue #11776 for why disabling a shared GCLK channel caused hangs. Track whether each timer pair is in use, then test the leak and partner-timer scenarios described here; done means reload no longer hangs and a partner PWMOut keeps running.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Drafted by Claude, reviewed by @dhalbert.
Background
@tannewt's atmel-samd finalizer-cleanup commit added turn_off_clocks() in timer_handler.c. PWMOut, PulseIn, PulseOut, AudioOut, RGBMatrix and PewPew called it when they released a timer. It disabled the timer's GCLK peripheral channel and its APB clock.
However, #11776 removes it, because timers share GCLK peripheral channels in pairs, and it caused a hang. Releasing one timer stopped its partner's clock:
- A
PWMOuton the partner timer stopped running. - Deinitializing the partner then waited forever for its software reset to sync. Boards hung at the end of the VM, with USB gone.
| Timers sharing a channel | |
|---|---|
| SAMD21 | TCC0/TCC1, TCC2/TC3, TC4/TC5, TC6/TC7 |
| SAMD51 | TC0/TC1, TCC0/TCC1, TC2/TC3, TCC2/TCC3, TC4/TC5, TC6/TC7 (TCC4 has its own) |
Proposal
Bring back turn_off_clocks(), but disable a shared GCLK peripheral channel only when neither timer in its pair is in use. The APB clock is per timer, so it can still be turned off on its own.
This needs a record of which timers are in use, for example a bitmask set when a timer is allocated and cleared in turn_off_clocks(). Each timer's peripheral channel ID from tc_gclk_ids[] and tcc_gclk_ids[] finds its partner.
How to test
- Leak one of each pin-owning object, including
PWMOutandPulseOuton both timers of a pair, then reload. The board shouldn't hang. - A
PWMOutkeeps running after an object on its partner timer is deinited.
- Langage dominant
- C
- Étoiles
- 4.6k
- Forks
- 1.4k
- Merge moyen
- 1 j 3 h
- PR mergées (30 j)
- 186
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de adafruit/circuitpython
-
Update Learn Guides for #11777Ouvertedocumentation rp2
Difficulté 1/5 1-3 heures Accessibilité débutants 67/100
adafruit/circuitpython#11779 ·
Les mainteneurs répondent en général sous 1 jour
-
documentation enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
adafruit/circuitpython#11689 ·
Les mainteneurs répondent en général sous 1 jour
-
bug espressif
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
adafruit/circuitpython#11763 ·
Les mainteneurs répondent en général sous 1 jour
-
Feather RP2350: MAX3421E instead of PIO USB host, or a second build?Peut-être pris @mikeysklar l’a pris il y a 8 jours. Ouverterp2 usb
adafruit/circuitpython#11697 · 5 commentaires · 2 personnes assignées ·
Les mainteneurs répondent en général sous 1 jour
-
rp2040 zephyr
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
adafruit/circuitpython#11690 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de adafruit/circuitpython
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 80/100
ly05010419/MacNativeGames#1897 ·
Les mainteneurs répondent en général sous 1 jour
-
area: metrics area: tracing contribfest enhancement good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
open-telemetry/opentelemetry-ebpf-instrumentation#4188 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
[hardware] `fn_pico_blob.h` names the wrong consumer and justifies PC fallbacks nothing usesOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
FujiNetWIFI/fujinet-firmware#2328 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
ycrash/yc-360-script#44 ·