How can I get 250 kHz CAN Bus with STM32F042G6U6 using HSE 8 MHz and STM32CubeIDE generated code?
When using HSI RC, everything works fine. After switching to HSE, Pinout&Configuration tab in STM32CubeIDE calculates a wrong TQ, as far as I can see. I use 250 kHz Bus, so 4 MHz clock results in TQ 250 ns. 16 TQ is 250 kHz.
For example, for PLLMult 4

I get, for prescaler 2 62.5 ns, although the value should be 250 ns:

I think that cannot be right, as my scope shows that frequency is 250 kHz:

and the device works fine in 250 kHz bus. Therefore, the prescaler divides external 8 MHz frequency by 2 and 4 MHz is 250 ns. If I choose any other prescaler, I get a wrong frequency.
The way to do it is to generate code with setup in the first 2 pictures and then change
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL4;
into
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
in the generated code.
If I try to choose multiplier 6, the IDE refuses to generate code as it calculates a wrong TQ.
Am I doing something wrong?
