Why is HSI_VALUE redefined in project options when LL drivers are used for RCC?
I'm trying to setup a project with STM32CubeIDE 1.8 (includes CubeMX 6.4) that uses LPUART1 on a STM32L031K6. I want to lower the CPU frequency to 4MHz, and, to reduce power, I'm using HSI/4 as clock input.
LPUART baudrate is set wrong (4 times higher than expected according to logic analyzer), it's generated out of PCLK1 frequency that is assigned as HSI_VALUE >> 2. While HSI_VALUE is defined in stm32l0xx_ll_rcc.h:
#define HSI_VALUE (16000000U)But, during debug I realize that HSI_VALUE value is 4000000, it is redefined as a compiler directive:
-mcpu=cortex-m0plus -std=gnu11 -g3 -DDEBUG -DSTM32L031xx -DUSE_FULL_LL_DRIVER -DHSE_VALUE=8000000 -DHSE_STARTUP_TIMEOUT=100 -DLSE_STARTUP_TIMEOUT=5000 -DLSE_VALUE=32768 -DMSI_VALUE=2097000 -DLSI_VALUE=37000 -DVDD_VALUE=3300 -DPREFETCH_ENABLE=0 -DINSTRUCTION_CACHE_ENABLE=1 -DDATA_CACHE_ENABLE=1 -DHSI_VALUE=4000000 -c -I../Core/Inc -I../Drivers/STM32L0xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32L0xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage --specs=nano.specs -mfloat-abi=soft -mthumbIf HSI is not divided by 4 it's just redefined as 16000000 and everything works ok.
If I use HAL driver for RCC HSI_VALUE is not redefined as a compiler directive so it's ok too.
I know that I can delete that redefinition from project options, but it's added again if I change anything in CubeMX and generate code again.
