-
Notifications
You must be signed in to change notification settings - Fork 69
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
Panic or crash when creating a timer with MHz frequencies #333
Comments
Okay, so this is definitely a bug. I've found out the cause. Thanks for the reports. I've come up with a fix, will open an MR soon (I hope) But in addition to the bug, I advise you to increase the Bus Clock speed of which the timer is connected to (PCLK2 in this case AFAIK), so that the resolution of the timer frequency is high enough. E.g Sadly, even with my fix, setting the resolution like this through the current API is not very precise. Especially for timer frequencies close to the peripheral bus clock speed. Maybe I should expose API to set the |
I've released version v0.9.2, which includes the fixes. Can you report, if this fixes your problem? |
Seems to work now! Thanks a lot for the quick response and fix! :D |
For the record, I used |
Thanks! :) You were lucky, that I was already working on this project that day, which I've neglected because of lack of time the last months 🙈 😀 |
First of all, I would just like to add that I'm not very experienced with embedded rust, and I might just be missing something trivial. However, I have looked through all the examples in this repo, and read the relevant pages in the crate documentation, but I'm none the wiser.
I'm trying to create a timer for use with the ws2812-timer-delay crate, which requires a timer running at 3MHz. When I try to implement this timer, the board doesn't do anything, and I've narrowed the problem down to the second line in this snippet.
If I comment it out, the code works, but if I include it, the board just "freezes" which I'm assuming means it has panicked or crashed.
If I change it to
Microseconds
and3.kHz()
, the board works, but I can't use a clock of 3kHz.In case it is relevant, the board in question is an STM32F303CB (On an OLKB planck rev6 board)
Is this behavior expected, and in that case why? Otherwise, am I doing something wrong, and how would I go about making a 3MHz timer?
The text was updated successfully, but these errors were encountered: