Skip to content
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

Fix alternative function mapping for I2C on PA9/10 #76

Merged
merged 1 commit into from
Feb 25, 2020

Conversation

rnestler
Copy link
Contributor

@rnestler rnestler commented Feb 4, 2020

No description provided.

@arkorobotics
Copy link
Member

This modification doesn't appear to match the Alternate Function pin mapping of the STM32L011. Which exact MCU is this in reference to?

@dbrgn
Copy link
Contributor

dbrgn commented Feb 5, 2020

Oh, that's really bad.

This is for the STM32L071KB.

071

The STM32L011x3/4 is different indeed:

011

That means that there are major AF differences within the STM32L0X1 series 🤕

There are also differences for the USART AFs: The STM32L071 has USART4_TX on PA0/AF6, while the STM32L077 has USART2_RX on PA0/AF0 (and no USART4 on PA0/AF6).

@DanSGiesbrecht
Copy link

DanSGiesbrecht commented Feb 15, 2020

@dbrgn do you have any advice on how to restructure to address differences between MCU's? I'm currently developing for both STM32L071 and STM32L051, and am happy to help.

@dbrgn
Copy link
Contributor

dbrgn commented Feb 16, 2020

I think the best long-term solution would be to extract AF mappings from the database shipped with CubeMX. The relevant discussion is probably at stm32-rs/stm32f0xx-hal#29.

@arkorobotics
Copy link
Member

Sounds like a good path forward given the inconsistencies. That said, I'm open to other ideas.

@arkorobotics arkorobotics merged commit e9f54e2 into stm32-rs:master Feb 25, 2020
@dbrgn dbrgn deleted the fix-i2c-af-mapping branch March 28, 2020 22:38
dbrgn added a commit to gfroerli/stm32l0xx-hal that referenced this pull request Mar 28, 2020
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`.
dbrgn added a commit to gfroerli/stm32l0xx-hal that referenced this pull request Apr 4, 2020
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants