-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add disco_f411ve #1135
Add disco_f411ve #1135
Conversation
902f3b6
to
bd0418c
Compare
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.
Thanks! Do you want to try the USB example on this one? Should be almost identical to the F407 disco.
static constexpr uint32_t Timer10 = Apb2Timer; | ||
static constexpr uint32_t Timer11 = Apb2Timer; | ||
|
||
static constexpr uint32_t Usb = 48_MHz; |
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.
Is this correct?
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.
I've setup a PWM on Timer10 and Timer11, confirmed the output frequency and looks fine.
But could not make USB / TinyUSB working.
Please give me some advice!
Observations:
- Power on without Usb-Cable, Leds blink period = 2.5s -> Seems to be the initial default
- Connecting an Usb-Cable, the Leds blink period remains at 2.5s ->
tud_mount_cb()
not invoked. - However, when disconnecting the Usb-Cable, the blink period changes to 250ms ->
tud_umount_cb()
invoked! - Reconnecting the cable again, changes nothing. The blink period remains at 250ms.
- Only a reset gets me back to 2.5s right now.
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.
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.
Actually, the /Q prescaler isn't set at all, so the USB probably runs at 100MHz or something completely wrong.
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.
Ok, i have not really tried to iunderstand the clock system yet. So i got a copy of CubeMX as it looks like an usefull reference. Have seen this graphical configurator before but your screenshot finally convinced me to give it a closer look, thanks!
USB now works 😄
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.
I swapped the prescalers to align with the CubeMX solution, so the CPU now runs at 96MHz and the USB still at 48MHz.
134d399
to
9f5b415
Compare
static constexpr uint32_t Timer10 = Apb2Timer; | ||
static constexpr uint32_t Timer11 = Apb2Timer; | ||
|
||
static constexpr uint32_t Usb = 48_MHz; |
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.
The PLL statements in all board.hpp could be moved above the SystemClock
struct to calculate
SystemClock::Frequency
and SystemClock::Usb
👉🏾 This would document the causality and the "...Usb requires 48Mhz..." assertion somewhere else in modm would have catched me!
Something like this:
static constexpr uint32_t CrystalHSE = 8;
const Rcc::PllFactors pllFactors {
...
}
static constexpr uint32_t MainPllClock = CrystalHSE / PllFactors.pllM * PllFactors.pllN;
static constexpr uint32_t SystemClock::Frequency = MainPllClock / PllFactors.pllP;
static constexpr uint32_t SystemClock::Usb = MainPllClock / PllFactors.pllQ;
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.
Ohhhhhhh, that's an excellent idea!!! I'll merge this first, then prototype it. We can probably also put the AHB/APB prescalers in there.
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.
Something easy, to build up 'momentum of success' will also support my motivational chemistry to complete the old graphic related PRs.
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.
I've quickly sketched this in #1137
6e47b9f
to
7e0b471
Compare
7e0b471
to
009bb06
Compare
Quite an old board i found behind the fridge. Very similar to disco_f407vg despite different clocks and PLL factors.
It's the only board in the modm collection featuring a stm32f411vet6, hence the clock and PLL constants maybe worth being stored.