-
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
Serial: Replace Pins
trait with TxPin
/ RxPin
#68
Conversation
0357eae
to
632955f
Compare
Rebased. |
Per the discussion in #67, this PR looks good to me. @hannobraun thoughts? |
I've taken a look and it looks good to me. But I didn't check any of this against the data sheets, and don't have time right now.
Are we sure that's good enough? I'm not volunteering, but it certainly wouldn't hurt if someone bit the bullet and checked it against all of them :-) |
632955f
to
1b0837a
Compare
Rebased again.
Since the previous values were sometimes plain wrong, it should not get any worse 😉 I did double-check all values against the datasheet, however it probably wouldn't hurt if someone else did that too. My approach was going to the ST page, opening the product selector for each chip family, picking a device with a large pin count package (e.g. LQFP 100) and taking a look at that datasheet. The values can be checked using the pin definition table, but it's a bit easier using the alternate functions table. |
Do we want to wait for these values to be verified or should we merge and update later as needed? |
I verified with the STM32L010RB (which isn't supported according to the readme). That one is definitely not compatible since it only has USART2 and LPUART1. Also it doesn't have a variant with 100 pins. |
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.
I also verified STM32L071RB against the datasheet. For me this is good enough for now.
Is there anything blocking this PR? |
cc @hannobraun |
I'm fine with this! |
Crap. This is on hold: #76 (comment) Apparently not all STM32L0x1 are created equal when considering AFs. |
@dbrgn Minor conflicts with the last merge, please advise. |
Not sure how I closed this PR. Reopening for the time being. |
Thanks! Now that #82 is merged, I'll proceed to generate proper mappings for the different GPIO peripheral versions. |
Alternatively, if #83 were implemented first, that would make things much easier. |
The previous approach with the `Pins` trait assumed that an USART peripheral can only be used with specific pin pairs. However, pins can be mixed, so you could use USART1 with PA9 and PB7. So instead of the `Pins` trait, there are now separate `TxPin` and `RxPin` traits. They are implemented for all pins of all U(S)ART peripherals of the stm32l0xx family. Pin mappings verified against datasheets of stm32l071kb, stm32l072vz and stm32l083vz.
1b0837a
to
9321f0b
Compare
This requires setting an io-* Cargo feature in order to access the `serial` module.
9321f0b
to
da1edcd
Compare
The previous definitions were based on the io-STM32L071 feature (product category 5).
@arkorobotics I think I have sorted this out! As suggested in this comment:
...I made the peripheral availability and the pin mappings dependent on the io-* features, similar to I²C in #87. See #87 for more details. 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 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. @arkorobotics this is now ready for review! Maybe @hannobraun would also be willing to take a quick look. |
Nice work! I love the idea of a universal pin mapping file, but as you pointed out it would require major changes. This is great for now :) Unless @hannobraun has any objects, I'll go ahead and merge this soon. |
I've only had the time to take a short glance, but no objections from me. |
Great, thanks for the review and the merge! |
Based on #66, merge that first. Fixes #67.
The previous approach with the
Pins
trait assumed that an USARTperipheral can only be used with specific pin pairs. However, pins can
be mixed, so you could use USART1 with PA9 and PB7.
So instead of the
Pins
trait, there are now separateTxPin
andRxPin
traits. They are implemented for all pins of all U(S)ARTperipherals of the stm32l0xx family.
Pin mappings verified against datasheets of stm32l071kb, stm32l072vz
and stm32l083vz.