1
\$\begingroup\$

I have a project that was previously using STM32F411, and I am trying to swap over to using a STM32F412 (UQFN48, so pin compatible).

I thought I should be able to use the STM32F411 firmware on the STM32F412 (just not using the extra RAM/flash). I can flash it over USB DFU (so the hardware works) and the firmware itself runs fine (so clock speeds are fine), but USB does not work on it.

Does anyone know what changed on USB between chip versions that would stop the F411's code from working on F412? Is it just a matter of flipping some bits in a register?

Thanks!

\$\endgroup\$
7
  • 1
    \$\begingroup\$ Quick compare of USB register map of both MCUs shows some differences in registers so it would depend on actual code, but it could be a problem. \$\endgroup\$ – Rokta Apr 21 at 11:59
  • \$\begingroup\$ Thanks - I'd compared the MCU-specific header files and found no real differences, but it looks like the USB peripheral has its own headers. There do appear to be the same registers at the same addresses, but there are definitely some extra bitfields in there \$\endgroup\$ – Gordon Williams Apr 21 at 12:21
  • \$\begingroup\$ I should add that USB doesn't even seem to be getting picked up. Running 'dmesg' on the PC it's connecting to leaves no notification that its even connected \$\endgroup\$ – Gordon Williams Apr 21 at 12:23
  • 1
    \$\begingroup\$ I thought first of vddusb but it is not available for UQFN48 I think. \$\endgroup\$ – Paul Ghobril Apr 21 at 16:02
  • 1
    \$\begingroup\$ F411 and F412 have different version of the USB core. F411 has version 1.2 while F412 has version 2.0. See the respective USB core ID registers. What USB library are you using. STM32 HAL? \$\endgroup\$ – Codo Apr 22 at 6:24
2
\$\begingroup\$

The clock configuration for the F412 is significantly more complicated than that for the F411. If you refer to the F12 Reference Manual, page 112, you find Figure 13:
enter image description here

Compare that to the F411 Reference Manual, page 93, Figure 12:
enter image description here

So there are at least 2 extra bits which need to be correctly configured just to get the 48MHz clock enabled for the USB module.

In addition to this there are some new bits in the F412 USB registers, but (at least superficially) it appears that these shouldn't have any effect as long as they're left at their default/reset values.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks! That's really helpful! I just checked and the CK48MSEL bit in RCC_DCKCFGR2 does at least seem to have the correct reset value (0 = PLL) but even so it does seem like there are some pretty serious differences between devices \$\endgroup\$ – Gordon Williams Apr 22 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.