How to unlock 5MHz Uart?

I want to use 5MHz uart, compiling with Visual Studio Code + Platform IO. My board us Nucleo-F303RE
I can set 4.5MHz, but 5MHz is not available.

Hello Igor

  • Create a project for the STM32F303 microcontroller in the STM32CubeIDE. It’s quite slow, as everything built with Java, so be patient.
  • Open the *.ioc file and with the Device Configuration Tool and try to set the same system clock configuration as used by Mbed in the following file:
mbed-os/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303xE/system_clock.c
  • Try to configure the UART (to set the 5MHz bit rate) with the Device Configuration Tool. If it’s impossible then I’m afraid there is no solution to your request. Otherwise, let the STM32CubeIDE generate the code (header and source files).
  • Try to find the related UART initialization code in the generated files and copy & paste it (the related sections) to your Mbed main.cpp. Don’t copy & paste the system clock configuration code sections since that has been already included into the project in the system_clock.c file by Mbed.