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

I2C communication not wotking because of wrong address #4

Merged
merged 1 commit into from May 4, 2019

Conversation

clebi
Copy link
Contributor

@clebi clebi commented May 2, 2019

I2C communications are not working because the address is not correctly written in SADD (CR2).

The address must be shifted because the LSB of SADD is ignore in 7 bits mode and we are only managing 7 bit mode.

Extract for CR2 register from documentation :

Bits 7:1 SADD[7:1]: Slave address bit 7:1 (master mode)
In 7-bit addressing mode (ADD10 = 0):
These bits should be written with the 7-bit slave address to be sent
In 10-bit addressing mode (ADD10 = 1):
These bits should be written with bits 7:1 of the slave address to be sent.
Note: Changing these bits when the START bit is set is not allowed.

Bit 0 SADD0: Slave address bit 0 (master mode)
In 7-bit addressing mode (ADD10 = 0):
This bit is don’t care
In 10-bit addressing mode (ADD10 = 1):
This bit should be written with bit 0 of the slave address to be sent
Note: Changing these bits when the START bit is set is not allowed.

…ss because the last bit of SADD is only used in 10bit mode and is ingore in 7 bit mode.

I2C communications were not functionnal before this fix because it had a bad address in SADD.
@dfrankland
Copy link
Member

Gah! Thank you so much for this 👍

@dfrankland dfrankland merged commit 5adf11c into stm32-rs:master May 4, 2019
@David-OConnor David-OConnor mentioned this pull request Jul 16, 2020
sirhcel pushed a commit to sirhcel/stm32f3xx-hal that referenced this pull request Jun 8, 2021
…ariants

Accept different errors in send_receive_wrong_baud
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