Yes, you are right - my crystal have 12MHz frequency and I missed this.

The fix is pretty simple - just by adding to the boards.txt for appropriate board/variant next config:
Code: Select all
xxx.build.extra_flags=-DHSE_VALUE=12000000

Code: Select all
xxx.build.extra_flags=-DHSE_VALUE=12000000