Open mirao opened 4 years ago
Your workaround with build_flags
is the best solution at the moment. We plan to improve the build script for stm32cube
framework, so it'll be able to handle such cases.
Just FYI: I've found out, that the external HSE oscillator was enabled because I confirmed the dialog Initialize all peripherals with their default mode? in STM32CubeMX when I was creating a new project. But the demo works even with internal HSI. It can be enabled in STM32CubeMX in "Clock Configuration => PLL Source HSI". HSI has only one frequency 16MHz and thus there's no need to apply any workaround.
Just adding my 2 cents (I spent a few days struggling with the same issue with I2S). From what I understand (being a newbie with STM32, HAL, and Platformio), stm32f4xx_hal_conf.h is supposed to be copied into the application code and customized. I have no idea how to do that (given that platformio is so good at hiding those details), so I used the workaround of using build flags too.
Steps to reproduce:
platform.ini
, this way:Expected result:
Actual result:
The problem is that the constant HSE_VALUE originally set to 8MHz by STM32Cube (see
#define
inInc/stm32f4xx_hal_conf.h
in project's root) isn't taken into account. App uses the default value from.platformio/packages/framework-stm32cube/f4/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_conf.h
instead and it is 25Mhz.But serial input/output over UART doesn't work well with such frequency.
Workaround:
platformi.ini
. It takes precedence before#define
in source codeUsed SW and HW: