-
Notifications
You must be signed in to change notification settings - Fork 1.3k
PWMOut reports "All timers in use" after creating a variable_frequency PWMOut object #7747
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
Comments
Yes, A reload should clear any pending state. If it doesn't, then it's a bug. |
I think this will have been fixed by #8966. |
I believe this falls into sort of a known issue or expected behavior category, so I'm fine closing it. That being said, from absolute newest:
The error message has changed but PWMOut is still not happy using D8 after variable_frequency is used. A control-D doesn't free up the resources, however a power cycle will. |
I was hoping the finaliser change fixed this, surprised it didn't. Maybe |
I took a quick look at the Grand Central pins.c and noticed that D8 is actually used by the SDIO databus as one of the SDIO_DATA lines. The SAMD common-hal sdioio/sdcard.c module has an empty never_reset function which if it had any code in it, would probably explain why ctrl-D wasn't releasing the resource. I'm guessing somewhere else in the sdioio sdcard construction the data pins are marked for no-reset and if that's the case, it might explain why a ctrl-D doesn't clear the resource. On the other hand... the board.c file doesn't appear to construct the sdioio bus and if the sdioio sdcard was constructed somewhere, I wouldn't have thought D8 would be available for pwmio use prior to the variable_frequency use. 🤷 |
Hi I'm having the same issue when using a RP2350 based board, and on different GPIOs than above, not used by anything else in my case. Strangely, a full hardware reset does not help, so it indicates that the L1 pwmio object creation does not allow the creation of R2. Note that I'm using on purpose GPIOs corresponding to the same PWM slice for L1/R1 (slice 1) and L2/R2 (slice 5), as I do need them to share the clock frequency, but not the duty cycle later.
Furthermore, any initialisation sequence which does not use variable_frequency=True, is working fine. |
CircuitPython version
Code/REPL
Behavior
Description
Once a PWMOut object is created using the variable_frequency=True option some pins which could previously have PWMOut objects successfully created on them return an "All timers in use" error. A Control-D does not clear the issue, a board reset is required to allow the erring pins to once again be used to create a PWMOut object. Only some pins seems to be impacted, others continue to function as expected.
Additional information
By using the script from the learning guide:
before and after creating a variable_frequency PWMOut object all the pins affected can be identified.
Looking through some other issues and old forum posts, it looks like there may be limitations on which Pins can be used for PWMOut in conjunction with variable_frequency PWMOut objects, but I would think those limitations would be dropped once the variable_frequency object was deinit'd. I would also think a Control-D would reset the pins to the same state as a power-up.
The text was updated successfully, but these errors were encountered: