Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PWM beeper forcing PWM to inactive statr
When disabling, some PWM hardware IP leaves the pin in the state it happens to be in at that very moment. To make sure it is in the inactive state, the duty cycle is now set to 0 first, before PWM is being disabled. Solves: EMP-628
- Loading branch information
eaace6d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is rather a nasty hack (as what you call 0 may be something else for other devices), in any case, the proper fix (whether it still works is of course unknown) was here:
f4c8526
eaace6d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nono, the bug is in the actual hardware and the use of the hardware. The current behavior of the driver is 'disable all clocks first', at which point the PWM periphieral which just stop at whatever it was doing. E.g. it will not finish its course. What f4c8526 does, is let the peripherial runs its course as being told; and then disable the clocks. Granted the f4c8526 may be an older version, as I recall removing the locking/unlocking bit at some point.
So while you are right that the true idle state is not defined, and this should be resolved; you are still making the peripheral stop without having finished its internal state machine! So for that, you are hacking around it.