-
Notifications
You must be signed in to change notification settings - Fork 60
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
Update I2C pin mappings based on STM32L0xx GPIO IP #87
Conversation
2f0109f
to
4a8e60f
Compare
I have verified this PR against an STM32L071KBTx MCU and at least I2C1 seems to work properly. |
The GPIO internal peripheral (IP) does not match the stm32l0x/stm32l0x2/stm32l0x3 grouping. Instead, there are 4 different GPIO IPs in the STM32L0 family that define how the pin functions are mapped to the actual pins. This means that the current I2C mappings are broken for a lot of MCUs. For reference, these issues have already been opened because the mappings were broken: - stm32-rs#76 - stm32-rs#77 - stm32-rs#85 We can use the `io-*` Cargo features to differentiate between these mappings. This requires that the proper `io-*` feature is set when compiling (and is thus a breaking change). The easiest way to apply the feature without looking at the STM32CubeMX database XML files is to simply use the proper `mcu-*` feature, for example `mcu-STM32L071KBTx`.
4a8e60f
to
a2dd816
Compare
feature = "io-STM32L031", | ||
feature = "io-STM32L051", | ||
feature = "io-STM32L071", | ||
))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple cfg
attributes are additive (so both need to match), right?
I'm not sure whether stm32l0x2
is still required, but on the other hand I don't have much experience with DMA yet.
Looks good! Thanks! |
The GPIO internal peripheral (IP) does not match the stm32l0x/stm32l0x2/stm32l0x3 grouping used in the PACs. Instead, there are 4 different GPIO IPs in the STM32L0 family that define how the pin functions are mapped to the actual pins. This means that the current I2C mappings are broken for a lot of MCUs. For reference, these issues have already been opened because the mappings were broken:
We can use the
io-*
Cargo features to differentiate between these mappings. This requires that the properio-*
feature is set when compiling (and is thus a breaking change). The easiest way to apply the feature without looking at the STM32CubeMX database XML files is to simply use the propermcu-*
feature, for examplemcu-STM32L071KBTx
.The pin mappings used in this changeset were taken out of the cube-parse output for the STM32L0 family. The output can be found here. To re-generate:
The source files in the STM32CubeMx database used to generate the mappings:
More information on the database format can be found in the cube-parse README.
The long-term solution should probably be a universal pin mapping file generated by cube-parse, but with the current APIs this would be a major refactoring. Therefore a manual fix must suffice for now.
Fixes #76, fixes #77, fixes #85.
CC @rnestler @DanSGiesbrecht @ijager