Merged
Conversation
… does not use STM_MODE_AF_PP
…uino core for F103 platform
Owner
|
Thanks for this fix. I'm not fan of having the define on the hal_conf_extra.h, because you need to also include that in platformio.ini for example. It would be better to have it on the STM32_CAN.h instead. But I'll include this as fix still. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains 3 fixes regarding the F1 platform.
Additionally the
hal_conf_extra.hfiles of the examples got a few extra notes about optional configuration defines.Alternate pinmap broken
With recent changes the handling of alternate function settings was was changed, letting the Arduino core do the low level work.
This caused a bug where the F1 platform alternate function re-mapping did not work.
A missing define prevented the actual remapping being called.
The necessary define is now defined in
hal_conf_extra.hby default.Possible fix for #47, #51, #52, parts of #49
RX pinmode clobbered
The CAN driver does enable the Pullup on the RX pin. The implementation did assume all defined pinmodes by Arduino use the
STM_MODE_AF_PPfor the CAN pins. This is not the case for the F1 platform, it usesSTM_MODE_INPUTfor.This PR contains a fix that no longer touches the mode, instead just modifies the pullup section of the pin function.
Alternate pinmode not defined
F103 platform files don't define a valid AFIO mode for the default pinmap.
Instead of defining
AFIO_CAN1_1justAFIO_NONEis used. This is no problem if the default is used since it is already active, or changing to another mode since it is defined. But when returning to the default mode after using an alternate mode previously (without reset), the correct mode would not be set, since none is defined (rare case).This PR contains a workaround that checks for
AFIO_NONEand overwrites it with the expectedAFIO_CAN1_1to correctly re-set the AFIO mode.