Skip to content

I2C: Wrong behavior with function setClock #1804

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

Closed
camelator opened this issue Aug 15, 2022 · 3 comments · Fixed by #1818
Closed

I2C: Wrong behavior with function setClock #1804

camelator opened this issue Aug 15, 2022 · 3 comments · Fixed by #1818
Assignees
Labels
bug 🐛 Something isn't working
Milestone

Comments

@camelator
Copy link

Considering 'M' a STM32Duino board as master.
Considering 'S' a STM32Duino board as slave.

1/ Having in setup() for both M and S function TwoWire::setClock(100000)
=> receiveEvent and requestEvent never called in S

2/ Having in setup() for M only function TwoWire::setClock(100000)
=> receiveEvent and requestEvent are called in S as expected.

Maybe the right way is to have this function working for masters only??? I don't know as I am not an i2c expert.

@ABOSTM ABOSTM added the bug 🐛 Something isn't working label Aug 26, 2022
@ABOSTM
Copy link
Contributor

ABOSTM commented Aug 26, 2022

Hi @camelator,
The right way is to call setClock() function on both Master and Slave.
I tested on my side and there is this function on slave side, Interrupt are disabled when exiting this function (it should not).
Thanks for highlighting this issue.
I will submit a patch soon.

By the way if you simply wants to set clock @100000Hz,
then it is the default value, and you could remove both calls to setClock()

@camelator
Copy link
Author

Abostm,
many thanks for the answer,
I've noticed the default speed with a logic analyzer :)
I have to say I am working on having these 2 STM32 boards working as slave and master, and it looks like some issue or constraints on the slave side are driving errors on the master side. And the root cause is difficult to analyze....
Please have a look on the following issue:
#1805

I suspect the clock signal to be the root cause of the problems I am facing. It can explain why it works well with slave MCU and not with slave CPU. But definitely, I am not sure.

regards,

Christian

@ABOSTM
Copy link
Contributor

ABOSTM commented Aug 29, 2022

@camelator
Fix is available : #1818
Let me know if this solve your setClock issue.

@fpistm fpistm added this to the 2.4.0 milestone Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants