Skip to content

STM32F401: Add FLTR register to all I2C peripherals #534

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

Merged
merged 2 commits into from
Apr 11, 2021

Conversation

yusefkarim
Copy link
Contributor

@yusefkarim yusefkarim commented Apr 10, 2021

This adds the I2C FLTR register defined in RM0368. I have tested this result in code that compiles and looks correct to me (see below). However, I have not tested that this indeed does the right thing in hardware. Not even sure how I would do that :).

i2c1.fltr.write(|w| w.anfoff().enabled().dnf().no_filter());

I only made changes in devices/stm32f401.yaml as I personally don't know whether other similar devices have this. For example, STM32L4 does not follow this structure, but maybe other STM32F4's do? Don't know.

@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.

Thanks for this PR! It's interesting, it looks like this FLTR register is widely missing but is present in many F4 devices (RM0090 says "F42x and F43x only", so it's not in the earliest F405/F407, but seems to be in everything else).

Since it looks like this change is also needed in many other F4 devices, would you mind putting these changes into new files? The part where you add FLTR could go in devices/common_patches/i2c_v1_fltr.yaml and the part describing the allowed values in peripherals/i2c/i2c_v1_fltr.yaml.

Those two files should then be included here in f401, and also in f410, f411, f412, and the peripherals file only in f413, f427, f429, f446, and f469 (which all already have the register but not the descriptions).

That would then complete coverage for I2C on all the F4 devices, which would be really nice!

Let me know if that doesn't make sense to you, or if you don't have time to do it yourself.

Also, I noticed the bitOffset was wrong, should be 0 instead of 4 since the field starts at bit 0.

@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.

Thanks for the update!

bors merge

@bors bors bot merged commit 81b6840 into stm32-rs:master Apr 11, 2021
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