Documentation Bug?

In the docs for build_board.f_cpu at Platform options — PlatformIO latest documentation the wording gives the impression that this will “overclock” the CPU:

You can overclock a board by specifying a board_build.f_cpu value other than the default.

I would suggest changing this wording as that setting should only be used when the board has a different clock frequency to the default. Perhaps to:

If you have changed a board’s clock frequency, then you should specify a board_build.f_cpu value to match the change.

your Leonardo board’s details are at Arduino Leonardo — PlatformIO latest documentation, where again, it does rather give the impression that the ini file setting will overclock the board!

Cheers,
Norm.

I agree, it’s bad wording. What f_cpu will do primarily is to change the value of the macro F_CPU. There may be some platform code that adapts other things addditionally to that, like changing the value of to-be-programmed fuses for Atmel AVRs if the user explicity executes the “Program Fuses” task, but it’s not going to do any real clock changing on the microcontroller, just changes the clock speed the software thinks it runs at. And so, mismatches between the actual clock frequency and the declared clock frequency can be created, leading to timing issues.

You should definitely file an issue at Issues · platformio/platformio-docs · GitHub.

Issue 230 raised. Documentation bug - board_build.f_cpu · Issue #230 · platformio/platformio-docs · GitHub

Cheers,
Norm.