Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

sirhcel
Copy link
Contributor

@sirhcel sirhcel commented May 28, 2021

The STM32F303 has 9 bit wide RDR and TDR registers and according to the SVDs this is the case for all other devices with this peripheral too. Make accessing TDR via tdr().bits() safe again by providing the appropriate constraints.

I stumbled upon this issue in rust-embedded/discovery#267 (comment).

The currently exisiting bitWidths have been quick-and-dirty checked using:

svd $ xmllint --xpath ".//field[(name = 'RDR' or name = 'TDR') and bitWidth != 9]" --format *.svd *.svd.patched

This gave not output while searching for bitWidth = 9 did.

The STM32F303 has 9 bit wide RDR and TDR registers and according to the
SVDs this is the case for all other devices with this peripheral too.
Make accessing TDR via tdr().bits() safe again by providing the
appropriate constraints.

The currently exisiting bitWidths have been quick-and-dirty checked
using:

    svd $ xmllint --xpath ".//field[(name = 'RDR' or name = 'TDR') and bitWidth != 9]" --format *.svd *.svd.patched
@github-actions
Copy link

Memory map comparison

Copy link
Member

@adamgreig adamgreig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

bors merge

@bors bors bot merged commit 5208696 into stm32-rs:master May 28, 2021
bors bot added a commit to rust-embedded/discovery that referenced this pull request Jun 21, 2021
354: Fix and clean up 11-usart by bumping dependencies r=adamgreig a=sirhcel

This is an alternate version of #267 which fixes the panic by bumping dependencies. It also addresses the previously unsafe access to the USARTs transmit and receive data registers (TDR and RDR, stm32-rs/stm32-rs#558) by bumping the BSP to the brand spanking new release 0.7.0 which comes with a fixed PAC and HAL. Thank you very much @adamgreig, @Sh3Rm4n, and @rubberduck203 for your patience and support along this journey!

This PR also bumps non-critical dependencies to their actual releases. For example `heapless`, which makes use of const generics nowadays.

I did not succeed in getting `mdbook test` to actually check the example code. I moved it over to the `examples` directory and included it in the Markdown files so that it can be checked with `cargo build --target thumbv7em-none-eabihf --examples`.

Co-authored-by: Christian Meusel <[email protected]>
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.

2 participants