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

stm32 i2c slave #2909

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

stm32 i2c slave #2909

wants to merge 2 commits into from

Conversation

jrmoulton
Copy link

This isn't quite finished. It only has the async slave implementation and the code needs to be cleaned up.

I could use some help debugging also.

In the listen method I enable the address match interrupt and register the waker in the poll closure.

The issue is that the runtime never polls the function again even when an address is matched.

If I write code that blocks instead of yielding and send and I2C communication the peripheral will still be enabled and will match the address.

I've tried also adding the wupen bit but that didn't make a difference

WUPEN:Wakeup from Stop mode enable 
0: Wakeup from Stop mode disable.
1: Wakeup from Stop mode enable.

Any idea why the runtime wouldn't poll the function again?

@bsodmike
Copy link
Contributor

bsodmike commented May 7, 2024

Hi Jared, interesting. Will respond soon if I figure anything out.

@jrmoulton
Copy link
Author

I've figured out why the function wasn't being polled. Now just working on finishing up the implementation

@jrmoulton
Copy link
Author

jrmoulton commented May 15, 2024

@Dirbaio the stm32 i2c supports multimaster for allowing both a master and a slave functionality. The slave mode is the default and the master mode is enabled by a start condition and ends with a stop condition.

Currently in this implementation I have split the slave from the master. This more closely matches the API in the embassy-rp crate. Would it be better to join them and merge the slave functionality into the regular i2c driver (in order to let you switch from slave to master without reconfiguring) or is it better to leave them split?

(edited)

@bsodmike
Copy link
Contributor

bsodmike commented May 16, 2024

I think being part of the regular driver works, if say you introduce a Option<Mode> type config option that is very obvious.

Thoughts?

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.

None yet

2 participants