Skip to content

Prevent redefine of HSE_VALUE if already user-overridden #1281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 18, 2021

Conversation

maxgerhardt
Copy link
Contributor

@maxgerhardt maxgerhardt commented Jan 17, 2021

Summary

Commercially sold Blackpill F411CE boards feature a 25MHz crystal, but if a board differs, HSE_VALUE can still be overridden while keeping everything else the same. With defensive programming like this, users of a custom (or differing commercially sold) board can easily use this variant with the same chip but just a slightly different crystal.

This PR fixes/implements the following bugs/features

  • Feature: Let users redefine HSE_VALUE if needed

This topic e.g. appeared in https://community.platformio.org/t/env-blackpill-f401ce-consistently-creates-bad-binaries-that-hangs-the-mcu/18567 when a user was trying to use this Arduino core with a custom board with the 3 interchangable chips F401CC, F401CE and F411CE, all having a 25MHz crystal.

If a user would ever want to use a similiar setup but with a 25MHz crystal where the Arduino core uses the default 8MHz one or vice versa, it would be nice to always let the user redefine HSE_VALUE. With a simple #ifndef check, that's implemented here.

Commercially sold Blackpill F411CE boards feature a 25MHz crystal, but if a board differs, HSE_VALUE can still be overridden while keeping everything else the same. With defensive programming like this, users of a custom (or differing commercially sold) board can easily use this variant with the same chip but just a slightly different crystal.
Same reasoning as previous commit
@fpistm fpistm added the enhancement New feature or request label Jan 18, 2021
@fpistm
Copy link
Member

fpistm commented Jan 18, 2021

Hi @maxgerhardt
in fact end user should use the generic variant if the board is a custom one.
The contributor who made those variant for the black pill define the correct clock value based on the hardware board definition.
Anyway, it is safe to allow this redefinition moreover I'm currently review/rewrite all the variant to be more generic and I already allow all redefiniton (just in case).

@fpistm fpistm merged commit 0303f55 into stm32duino:master Jan 18, 2021
@fpistm fpistm added this to the 2.0.0 milestone Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants