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

stm32f401 i2c can not work , Addr Flag Not Setting with the I2C Communication #547

Open
flyingyizi opened this issue Oct 26, 2022 · 0 comments

Comments

@flyingyizi
Copy link

case: examples/ssd1306-image.rs
mcu: stm32f401 in proteus
hal version: stm32f4xx-hal = "0.13.2"

problem:

through proteus's I2C debugger, find only occurs "S 78 A P", then the MCU hang. the final positon is in I2c::write_bytes.

    fn write_bytes(&mut self, addr: u8, bytes: impl Iterator<Item = u8>) -> Result<(), Error> {
        ....
        // Wait until address was sent
        loop {
            // Check for any I2C errors. If a NACK occurs, the ADDR bit will never be set.
            let sr1 = self
                .check_and_clear_error_flags()
                .map_err(Error::nack_addr)?;

            // Wait for the address to be acknowledged
            if sr1.addr().bit_is_set() {
                break;
            }
        }
        ...
    }

through the i2c transaction, we know i2c slave(ssd1306) already returned ACK. why the problem occours.

thanks.

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

No branches or pull requests

1 participant